Django, Security and Settings

前端 未结 3 1957
北海茫月
北海茫月 2020-12-31 07:29

From here, we add all database info as text:

DATABASES = {
\'default\': {
    \'ENGINE\': \'django.db.backends.postgresql\',
    \'NAME\': \'mydatabase\',
           


        
3条回答
  •  星月不相逢
    2020-12-31 08:11

    Would like to thank Sayse for the wonderful idea of using Environment variables. For those using Pycharm to connect to a mysql database, you need to create a 'USER' environment variable and call it using os.environ.get('environment variable', '') if you want to avoid storing the database password in the settings.py.

提交回复
热议问题