将Django项目上载到pythonanywh时未找到文件错误

2024-10-01 05:07:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试上传一个django项目到pythonanwhere免费帐户。这个项目有两个excel文件需要我解析(使用xlrd模块)

这是我的python文件映射

-prvgroups
  -PRVGROUPS
  -***.xlsx
  -***.xlsx
  -***.xlsx

django抛出以下错误

^{pr2}$

我试图从CDN中引用excel文件,但仍然找不到excel路径

我的WSGI文件:

import os
import sys
#
## assuming your django settings file is at '/home/KjPacino/mysite/mysite/settings.py'
## and your manage.py is is at '/home/KjPacino/mysite/manage.py'
#path = '/home/KjPacino/mysite'
path = '/home/KjPacino/prvgroups'
if path not in sys.path:
    sys.path.append(path)
#
os.environ['DJANGO_SETTINGS_MODULE'] = 'PRVGroups.settings'
#
## then, for django >=1.5:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
## or, for older django <=1.4
#import django.core.handlers.wsgi
#application = django.core.handlers.wsgi.WSGIHand

我的设置.py文件

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

编辑

我的Python似乎也指向了正确的方向

Python Path:    

['/var/www',
 '.',
 '',
 '/var/www',
 '/home/KjPacino/.virtualenvs/sandbox/lib/python3.4',
 '/home/KjPacino/.virtualenvs/sandbox/lib/python3.4/plat-x86_64-linux-gnu',
 '/home/KjPacino/.virtualenvs/sandbox/lib/python3.4/lib-dynload',
 '/usr/lib/python3.4',
 '/usr/lib/python3.4/plat-x86_64-linux-gnu',
 '/home/KjPacino/.virtualenvs/sandbox/lib/python3.4/site-packages',
 '/home/KjPacino/prvgroups']

Tags: 文件pathdjangopyimportwsgihomeapplication