Python中文
首页
教程
问答
标签
搜索
登录
注册
python管理.pyrunserver错误:ModuleNotFoundError:没有名为“settings”的模块
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我正在着手使用python,在使用django2.1和python3.7时遇到了一个问题,其他人似乎也遇到了这个问题。在</p> <p>以下是我到达这里的过程:</p> <ul> <li><p>启动了一个虚拟环境</p></li> <li><p>启动了一个django项目</p></li> <li><p>尝试运行:</p></li> </ul> <blockquote> <p>python manage.py runserver</p> </blockquote> <p>我一直收到错误:ModuleNotFoundError:没有名为“settings”的模块</p> <p>我对下面的问题进行了广泛的研究,并发现了一些解决方法,但这些问题对我来说都不是有效的解决方案。有人遇到过这个问题吗?在</p> <p><a href="https://stackoverflow.com/questions/36210686/importerror-no-module-named-mysite-settings-django/36211423">First question researched</a></p> <p><a href="https://stackoverflow.com/questions/7367577/django-shell-no-module-named-settings">Second Question researched</a></p> <p>任何见解都会有帮助。提前谢谢。在</p> <p>编辑:我的管理.py文件如下所示:</p> <pre><code>#!/usr/bin/env python import os import sys if __name__ == '__main__': os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mytodoapp.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) </code></pre> <p>我的文件结构如下:</p> <blockquote> <blockquote> <p>mytodoapp</p> </blockquote> <p>粘虫</p> ^{pr2}$ <p>在管理.py在</p> </blockquote> <p><a href="https://i.stack.imgur.com/vS6Dz.png" rel="nofollow noreferrer">Screenshot of my console</a></p> <p><a href="https://i.stack.imgur.com/aq4I4.png" rel="nofollow noreferrer">Manage.py file</a></p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>django 2.1需要python3.5+,它支持管理.py文件。在</p> <p>激活您的环境并验证您的python是3.7 如果不是,那么在创建virtualenv时指定python版本。在</p> <pre><code>virtualenv -p /path/to/your/python3.7 code </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
我想从用户inpu创建一个类的实例
8 回答
我想从用户导入值,为此
3 回答
我想从用户那里得到一个整数输入,然后让for循环遍历该数字,然后调用一个函数多次
3 回答
我想从用户那里收到一个列表,并在其中执行一些步骤,然后在步骤完成后将其打印回来,但它没有按照我想要的方式工作
6 回答
我想从用户那里获取输入,并将值传递给(average=dict[x]/6),然后在那里获取resu
8 回答
我想从第一个列表中展示第一个词,然后从第二个列表中展示十个词,以此类推- Python
4 回答
我想从第一个空lin开始解析文本文件
5 回答
我想从简历、简历中提取特定部分
6 回答
我想从给定字典(python)的字符串中删除\u00a9、\u201d和类似的字符。
8 回答
我想从给定的网站Lin下载许多文件扩展名相同的Wget或Python文件
5 回答
我想从网上搜集一些关于抵押贷款的数据
2 回答
我想从网站上删除电子邮件地址
9 回答
我想从网站上读取数据该网站包含可下载的文件,然后我想用python脚本把它发送给oracle如何?
3 回答
我想从网站中提取数据,然后将其显示在我的网页上
2 回答
我想从网页上提取统计数据。
5 回答
我想从网页上解析首都城市,并在用户输入国家时在终端上打印它们
9 回答
我想从色彩图中删除前n个颜色,而不丢失原始颜色数
1 回答
我想从课堂上打印字典里的键
6 回答
我想从费用表中获取学生上次支付的费用,其中学生id=id
3 回答
我想从较低的顺序对多重列表进行排序,但我无法在一行中生成结果
6 回答