繁体   English   中英

如何将现有的django项目导入pycharm

[英]how to import an existing django project to pycharm

我有以下目录树

myproject
├── data
├── libs
└── wsgi
    ├── openshift
    └── static

openshift包含设置文件和manage.py文件。 我想通过pycharm来管理manage.py但是它不起作用,runserver命令和startapp都没有任何准确性。

运行startapp会给我以下错误

bash -cl "/usr/bin/python2.7 manage.py startapp quiz"
/usr/bin/python2.7: can't open file 'manage.py': [Errno 2] No such file or directory

Process finished with exit code 2

运行runserver它给了我以下内容

ImportError: Could not import settings 'openshift.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named openshift.settings

Process finished with exit code 1

我启用了django支持并将wsig设置为django root项目。 从终端运行manage.py工作正常。

我究竟做错了什么?

编辑:从pycharm运行manage.py shell也可以运行EDIT2:我设法通过跟随openshift的结构并使openshift成为django项目根文件夹并对导入进行一些编辑来实现它。 现在一切都很好

打开myproject作为你的项目,然后转到PyCharm - > Preferences ... - > Django,启用Django支持,然后选择你的Django项目根目录,设置文件和管理脚本。

只需打开pycharm并在文件菜单中选择打开选项。 然后选择你的目录并完成..!

如果您在使用命令行时遇到问题,那么您应该尝试从pycharm本身构建一个新项目。

我通常会更改运行配置的工作目录选项。

您可以在该字段中键入工作目录路径,然后python将找到项目的设置模块

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM