1024programmer Java PyCharm: DJANGO_SETTINGS_MODULE is undefined – PyCharm: DJANGO_SETTINGS_MODULEisundefined

PyCharm: DJANGO_SETTINGS_MODULE is undefined – PyCharm: DJANGO_SETTINGS_MODULEisundefined

I am using PyCharm IDE and when I run any file.py I get this error:

I am using PyCharm IDE and when I run any file.py I get this error:

..raise ImportError(“Settings cannot be imported, because environment variable %s is undefined.” % ENVIRONMENT_VARIABLE) ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

..raise ImportError(“Cannot import settings because environment variable %s is not defined.” %ENVIRONMENT_VARIABLE) ImportError: Cannot import settings because environment variable is not defined DJANGO_SETTINGS_MODULE.

How to configure DJANGO_SETTINGS_MODULE environment variable in PyCharm?

How to configure the DJANGO_SETTINGS_MODULE environment variable in PyCharm?

4 solutions

#1


18

I had the same problem. The settings of my django support was empty:

I have the same problem. My django supported settings are empty:

PyCharm project config

#2


9

I had the same problem as well, and the fix in IntelliJ IDEA is not obvious (especially since there is no notification with a “fix-it” link for this problem).

I had the same problem and the fix in IntelliJ IDEA was not obvious (especially since there is no “fix-it” link for this issue notify).

You’ll find you need to set Settings to your Django project’s settings.py file in Project Structure > Modules > [your Django project’s name] > Django.

You will find that you need to set the settings to your Django project’s settings.py file in Project Structure > Modules > [your Django project name] > Django.

Now you know where to stick it.

#3


8

You can go to the tool bar which shows a dropdown and select your project ->edit configuration. There in the Environment variable area enter DJANGO_SETTINGS_MODULE mysite.settings and save .

You can go to the toolbar that shows the drop-down list and select Project -> Edit Configuration. Enter DJANGO_SETTINGS_MODULE mysite.settings in the Environment variable area and save.

#4


7

“Standalone Django scripts”

“Stand-alone Django script”

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/759221

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索