[Tutor] Including files for security.
Dotan Cohen
dotancohen at gmail.com
Sun Aug 24 19:41:05 CEST 2008
2008/8/24 Kent Johnson <kent37 at tds.net>:
> On Sun, Aug 24, 2008 at 12:08 PM, Dotan Cohen <dotancohen at gmail.com> wrote:
>> I have a specific file in the web tree that makes a database call. I
>> am uncomfortable keeping the database username and password in the
>> file. In PHP I usually put the database connection data in a file
>> outside the web tree and use the include (http://il.php.net/include/)
>> function to get the data. Is there a similar mechanism in Python? What
>> do other Python programmers use?
>
> You can use the normal file open() and read() functions to read the
> username and password from a file. You can write the file as a Python
> module, put it somewhere in the Python path and import it. You can use
> the ConfigParser module to read an INI file...
>
> Kent
>
I think that I will use the open() and read() functions, thanks! I did
think of that, but I wanted to know if there was a better wheel
invented already.
--
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ä-ö-ü-ß-Ä-Ö-Ü
More information about the Tutor
mailing list