用pycharm启动django报错。
我用pycharm2016.1启动django项目会报错,如下:
Traceback (most recent call last):
File "C:/Users/wenqiang/Desktop/pyjh_xueqi_0803/manage.py", line 27, in <module>
execute_from_command_line(sys.argv)
File "C:Python27libsite-packagesdjangocoremanagement__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:Python27libsite-packagesdjangocoremanagement__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:Python27libsite-packagesdjangocoremanagementbase.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:Python27libsite-packagesdjangocoremanagementbase.py", line 279, in execute
saved_locale = translation.get_language()
File "C:Python27libsite-packagesdjangoutilstranslation__init__.py", line 154, in get_language
return _trans.get_language()
File "C:Python27libsite-packagesdjangoutilstranslation__init__.py", line 52, in getattr
if settings.USE_I18N:
File "C:Python27libsite-packagesdjangoconf__init__.py", line 54, in getattr
self._setup(name)
File "C:Python27libsite-packagesdjangoconf__init__.py", line 47, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Process finished with exit code 1
但是在该文件下用命令行启动就没问题:
求解
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
新建一个虚拟环境在设置中选择使用你的虚拟环境