# Python Configuration file

**URL:** <https://forums.digi.com/t/python-configuration-file/19562>\
**Category:** Python\
**Tags:** python\
**Created:** [May 30, 2018, 11:15am UTC](https://forums.digi.com/t/python-configuration-file/19562 "2018-05-30T11:15:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![cainxalakev](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@cainxalakev](https://forums.digi.com/u/cainxalakev)\
**Post date:** [May 30, 2018, 11:15am UTC](https://forums.digi.com/t/python-configuration-file/19562/1 "2018-05-30T11:15:57Z")

</div>

Hi! I’m trying to get the python configuration source code from the python page of the web app and I’m not sure how to do it. Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![menakasama](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@menakasama](https://forums.digi.com/u/menakasama)\
**Post date:** [July 17, 2018, 4:28pm UTC](https://forums.digi.com/t/python-configuration-file/19562/2 "2018-07-17T16:28:27Z")

</div>

[Python training in Chennai](https://nareshit.in/python-training-chennai/)

#!/usr/bin/env python  
import preprocessing  
mysql = {‘host’: ‘localhost’,  
‘user’: ‘root’,  
‘passwd’: ‘my secret password’,  
‘db’: ‘write-math’}  
preprocessing\_queue = [preprocessing.scale\_and\_center,  
preprocessing.dot\_reduction,  
preprocessing.connect\_lines]  
use\_anonymous = True

Within the actual code, you can use it like this:

#!/usr/bin/env python  
import databaseconfig as cfg  
connect(cfg.mysql[‘host’], cfg.mysql[‘user’], cfg.mysql[‘password’])

---

<div class="post-metadata">

**Author:** ![unicsol](https://avatars.discourse-cdn.com/v4/letter/u/77aa72/32.png) [@unicsol](https://forums.digi.com/u/unicsol)\
**Post date:** [May 9, 2019, 3:41pm UTC](https://forums.digi.com/t/python-configuration-file/19562/3 "2019-05-09T15:41:42Z")

</div>

I Found this article useful same as your. you can visit by clicking [java training in Hyderabad](https://unicsol.com/)

#!/usr/bin/env python  
import preprocessing  
mysql = {‘host’: ‘localhost’,  
‘user’: ‘root’,  
‘passwd’: ‘my secret password’,  
‘db’: ‘write-math’}  
preprocessing\_queue = [preprocessing.scale\_and\_center,  
preprocessing.dot\_reduction,  
preprocessing.connect\_lines]  
use\_anonymous = True

Within the actual code, you can use it like this:

#!/usr/bin/env python  
import databaseconfig as cfg  
connect(cfg.mysql, cfg.mysql, cfg.mysql)

---

<div class="post-metadata">

**Author:** ![cbitssexp](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@cbitssexp](https://forums.digi.com/u/cbitssexp)\
**Post date:** [June 24, 2019, 4:17pm UTC](https://forums.digi.com/t/python-configuration-file/19562/4 "2019-06-24T16:17:08Z")

</div>

#!/usr/bin/env python  
import preprocessing  
mysql = {‘host’: ‘localhost’,  
‘user’: ‘root’,  
‘passwd’: ‘my secret password’,  
‘db’: ‘write-math’}  
preprocessing\_queue = [preprocessing.scale\_and\_center,  
preprocessing.dot\_reduction,  
preprocessing.connect\_lines]  
use\_anonymous = True

[PHP training in Chandigarh](http://cbitss.in/php-training-in-chandigarh/)

---

<div class="post-metadata">

**Author:** ![ravikumar9](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@ravikumar9](https://forums.digi.com/u/ravikumar9)\
**Post date:** [April 14, 2020, 3:29pm UTC](https://forums.digi.com/t/python-configuration-file/19562/5 "2020-04-14T15:29:22Z")

</div>

Go to [https://github.com/python/cpython](https://github.com/python/cpython).

Press Fork on the top right.

When asked where to fork the repository, choose to fork it to your username.

Your fork will be created at [https://github.com//cpython](https://github.com//cpython).

Clone your GitHub fork (replace with your username):

$ git clone [git@github.com](mailto:git@github.com):/cpython.git  
(You can use both SSH-based or HTTPS-based URLs.)

Configure an upstream remote:

$ cd cpython  
$ git remote add upstream [git@github.com](mailto:git@github.com):python/cpython.git  
Verify that your setup is correct:

$ git remote -v  
origin [git@github.com](mailto:git@github.com):/cpython.git (fetch)  
origin [git@github.com](mailto:git@github.com):/cpython.git (push)  
upstream [git@github.com](mailto:git@github.com):python/cpython.git (fetch)  
upstream [git@github.com](mailto:git@github.com):python/cpython.git (push)

---

<div class="post-metadata">

**Author:** ![datasciencetraining](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@datasciencetraining](https://forums.digi.com/u/datasciencetraining)\
**Post date:** [April 21, 2020, 8:08am UTC](https://forums.digi.com/t/python-configuration-file/19562/6 "2020-04-21T08:08:24Z")

</div>

#!/usr/bin/env python  
import preprocessing  
mysql = {‘host’: ‘localhost’,  
‘user’: ‘root’,  
‘passwd’: ‘my secret password’,  
‘db’: ‘write-math’}  
preprocessing\_queue = [preprocessing.scale\_and\_center,  
preprocessing.dot\_reduction,  
preprocessing.connect\_lines]  
use\_anonymous = True

Within the actual code, you can use it like this:

#!/usr/bin/env python  
import databaseconfig as cfg  
connect(cfg.mysql, cfg.mysql, cfg.mysql)

[Data Analytics Course in Hyderabad](https://360digitmg.com/data-analytics-certification-training-course-in-hyderabad)  
[Business Analytics Course in Hyderabad](https://360digitmg.com/business-analytics-training-in-hyderabad)  
[Data Analytics Training in Hyderabad](https://360digitmg.com/data-analytics-certification-training-course-in-hyderabad)

---

<div class="post-metadata">

**Author:** ![datasciencetraining](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@datasciencetraining](https://forums.digi.com/u/datasciencetraining)\
**Post date:** [May 19, 2020, 11:11am UTC](https://forums.digi.com/t/python-configuration-file/19562/7 "2020-05-19T11:11:47Z")

</div>

#!/usr/bin/env python  
import preprocessing  
mysql = {‘host’: ‘localhost’,  
‘user’: ‘root’,  
‘passwd’: ‘my secret password’,  
‘db’: ‘write-math’}  
preprocessing\_queue = [preprocessing.scale\_and\_center,  
preprocessing.dot\_reduction,  
preprocessing.connect\_lines]  
use\_anonymous = True

Within the actual code, you can use it like this:

#!/usr/bin/env python  
import databaseconfig as cfg  
connect(cfg.mysql, cfg.mysql, cfg.mysql)

[Data Analytics Training in Hyderabad](https://360digitmg.com/data-analytics-certification-training-course-in-hyderabad) | [Business Analytics Training in Hyderabad](https://360digitmg.com/business-analytics-training-in-hyderabad) |[Data Analytics Course in Hyderabad](https://360digitmg.com/data-analytics-certification-training-course-in-hyderabad) |[Business Analytics Course](https://360digitmg.com/business-analytics-training-in-hyderabad) |[Data Analytics Course](https://360digitmg.com/data-analytics-certification-training-course-in-hyderabad)

---

<div class="post-metadata">

**Author:** ![STonde](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@STonde](https://forums.digi.com/u/STonde)\
**Post date:** [June 22, 2020, 1:21pm UTC](https://forums.digi.com/t/python-configuration-file/19562/8 "2020-06-22T13:21:15Z")

</div>

#!/usr/bin/env python  
import preprocessing  
mysql = {‘host’: ‘localhost’,  
‘user’: ‘root’,  
‘passwd’: ‘my secret password’,  
‘db’: ‘write-math’}  
preprocessing\_queue = [preprocessing.scale\_and\_center,  
preprocessing.dot\_reduction,  
preprocessing.connect\_lines]  
use\_anonymous = True

Within the actual code, you can use it like this:

#!/usr/bin/env python  
import databaseconfig as cfg  
connect(cfg.mysql, cfg.mysql, cfg.mysql)

You seem to be having some troubles. Selenium classes in Pune can help you out.  
[https://www.sevenmentor.com/selenium-training-in-pune.php](https://www.sevenmentor.com/selenium-training-in-pune.php)

---

<div class="post-metadata">

**Author:** ![ethicalinstitute](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@ethicalinstitute](https://forums.digi.com/u/ethicalinstitute)\
**Post date:** [July 16, 2020, 8:30am UTC](https://forums.digi.com/t/python-configuration-file/19562/9 "2020-07-16T08:30:19Z")

</div>

; Sample configuration file  
[installation]  
library = %(prefix)s/lib  
include = %(prefix)s/include  
bin = %(prefix)s/bin  
prefix = /usr/local  
[Ethical Hacking Course in Bangalore](https://360digitmg.com/india/ethical-hacking-course-training-in-bangalore)  
[Certified Ethical Hacker Course](https://360digitmg.com/india/ethical-hacking-course-training-in-bangalore)

---

<div class="post-metadata">

**Author:** ![sagarpatil05](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@sagarpatil05](https://forums.digi.com/u/sagarpatil05)\
**Post date:** [July 2, 2026, 10:09am UTC](https://forums.digi.com/t/python-configuration-file/19562/10 "2026-07-02T10:09:32Z")

</div>

# config.py

1. 

import os  
from dotenv import load\_dotenv

load\_dotenv()

MYSQL = {  
“host”: os.getenv(“DB\_HOST”),  
“user”: os.getenv(“DB\_USER”),  
“password”: os.getenv(“DB\_PASSWORD”),  
“database”: os.getenv(“DB\_NAME”),}

1. 

# app.py

from config import MYSQL  
import mysql.connector

connection = mysql.connector.connect(\*\*MYSQL)

1. 

# config.py

import os

class Config:  
DB\_HOST = os.getenv(“DB\_HOST”)  
DB\_USER = os.getenv(“DB\_USER”)  
DB\_PASSWORD = os.getenv(“DB\_PASSWORD”)  
DB\_NAME = os.getenv(“DB\_NAME”)

**If you’re looking to build in-demand IT skills, NetTech India offers industry-focused training with hands-on learning and expert guidance**

> **[Python Training in Mumbai & Nearby Areas | Offline & Online Classes](https://www.nettechindia.com/python-training-course-institute-thane-mumbai)**
>
> Learn Certified Python Course with practical training at NetTech India. Offline & online classes in Mumbai, Andheri, Thane, Kalyan & Dadar. Enroll today.
