我在MAC OS X Yosemite上运行Django manage.py runserver时遇到问题。
重新启动后我很快就运行它,一切正常。但几分钟后,运行进程将停止,当我重新运行manage.py runserver时,它将生成此错误
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
任何帮助将不胜感激
谢谢!
答案 0 :(得分:0)
对于OSError [Error123],无需升级或降级您的Django版本。 我连续数周收到此错误,并且考虑了此错误的真正原因,因为我的代码和文件都完美无缺!但是然后,在观察了我的代码几周之后,我发现了那个错误的地狱!
答案-请在您的项目中创建您的APPS,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.
答案 1 :(得分:-1)
我设法解决了这个问题。事实证明,因为在这个Django版本中,我需要将wsgi文件分开以供开发和生产使用。因此wsgi_prod.py和wsgi.py。在以前版本的Django中不需要此操作。