AWS Ubuntu上的Django无法看到manage.py

时间:2018-08-14 16:52:27

标签: python django ubuntu amazon-ec2 ubuntu-16.04

from django.shortcuts import render
import json, sys, os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.join(BASE_DIR, 'imecaff_logic'))
try: os.chdir(os.path.join(BASE_DIR, 'imecaff_logic'))
except OSError: print("Can't change the Current Working Directory")
from imecaff_logic import main as logic_main

我在AWS Ubuntu上安装了Django。一切正常,但是当我尝试将其与解析器连接时,出现错误。

然后,我从另一个文件夹(from imecaff_logic import main as logic_main)导入main.py文件。

这是我得到的错误:

(env_imecaff) ubuntu@ip-172-31-33-221:~/imecaff/imecaff_local$ python manage.py runserver 0.0.0.0:8000
manage /home/ubuntu/imecaff/imecaff_local
manage /home/ubuntu/imecaff/imecaff_local
Performing system checks...

views1 /home/ubuntu/imecaff/imecaff_local/imecaff_logic
Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 60, in execute
    super().execute(*args, **options)
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 95, in handle
    self.run(**options)
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 102, in run
    autoreload.main(self.inner_run, None, options)
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/utils/autoreload.py", line 323, in main
    python_reloader(wrapped_main_func, args, kwargs)
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/utils/autoreload.py", line 302, in python_reloader
    reloader_thread()
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/utils/autoreload.py", line 274, in reloader_thread
    change = fn()
  File "/home/ubuntu/imecaff/env_imecaff/lib/python3.5/site-packages/django/utils/autoreload.py", line 204, in code_changed
    stat = os.stat(filename)
FileNotFoundError: [Errno 2] No such file or directory: ‘manage.py'

在Mac和PC上,相同的代码可以完美地工作。 有什么想法吗?

0 个答案:

没有答案