Django 运行 manage.py 在 OS X Yosemite 中生成 OS 错误

Django run manage.py generates OS error in OS X Yosemite

我在 运行ning Django manage.py 运行服务器上遇到问题 MAC OS X Yosemite.

当我运行它重新启动后不久,一切正常。但是几分钟后,运行ning进程会停止,当我重新运行 manage.py 运行服务器时,会产生这个错误

Performing system checks...

System check identified no issues (0 silenced).
January 22, 2015 - 15:10:11
Django version 1.7.3, using settings 'mycustomapp.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
 File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 83, in handle
self.run(*args, **options)
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 92, in run
autoreload.main(self.inner_run, args, options)
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/utils/autoreload.py", line 322, in main
reloader(wrapped_main_func, args, kwargs)
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/utils/autoreload.py", line 288, in python_reloader
reloader_thread()
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/utils/autoreload.py", line 264, in reloader_thread
change = fn()
File "/Users/fendy/.virtualenvs/mycustomapp/lib/python2.7/site-packages/django/utils/autoreload.py", line 202, in code_changed
stat = os.stat(filename)
OSError: [Errno 2] No such file or directory: './manage.py'

请注意,我与 manage.py 位于同一目录中。但由于某些原因,它找不到它

这是我在 运行 ls 时发现的: manage.py requirements.txt mycustomapp

我的 django 版本是 1.7.3,OS YOSEMITE,我已经更新和升级了所有 brew

如有任何帮助,我们将不胜感激

谢谢!

我已经设法解决了这个问题。事实证明,因为在此 Django 版本中,我需要将 wsgi 文件分开以供开发和生产使用。因此 wsgi_prod.py 和 wsgi.py 。以前版本的 Django 不需要此操作。

无需为 OSError [Error123] 升级或降级 Django 版本。 我收到这个错误好几个星期了,我思考了这个错误背后的真正原因,因为我的代码和文件都很完美!但是,在对我的代码进行了数周的观察之后,我发现了那个该死的错误!

回答 - 请在您的项目中创建您的应用程序、STATIC-FOLDER、TEMPLATE-FOLDER 和其他内容!!

演示 -> {“>>”表示下一步}

OPEN POWERSHELL >> mkdir DIRECTORY_NAME >> cd DIRECTORY_NAME >> code .

this will open visual studio code within the directory named (DIRECTORY_NAME)

OPEN TERMINAL >> install django >> django startproject PROJECT_NAME >>
cd PROJECT_NAME >> python manage.py runserver >> COME OUT OF THE SERVER >> django startapp APP_NAME >> CONTINUE YOUR WORK IN THE VS CODE AND ONLY COM TO TERMINAL TO RUN SERVER.