简体   繁体   English

在Django 1.7.6上运行django-oscar的Heroku上从Python 2.7切换到Python 3.4时导入错误

[英]Import Error When Switchin from Python 2.7 to Python 3.4 on Heroku running django-oscar on django 1.7.6

Somewhat similar issue to this one although not quite. 尽管不完全相同,但与问题有些相似。 Installation was running fine on Heroku and Python 2.7 and also fine with Python 3.4 on my dev machine (OS X). 安装在Heroku和Python 2.7上运行良好,在我的开发机(OS X)上也可以运行Python 3.4。 Regretfully switched over to Python 3.4 on Heroku as well and am now getting 遗憾地也在Heroku上切换到Python 3.4,现在越来越

 Django Version:    1.7.6
 Exception Type:    ImportError
 Exception Value: cannot import name 'shop' in urls.py  in <module>, line 5

Oscar is installed in the virtual env and imports without a problem from the shell Oscar已安装在虚拟环境中,并且可以从shell顺利导入

wsgi.py looks as follows: wsgi.py看起来如下:

 import os
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "super_secret_project.settings")`

 from django.core.wsgi import get_wsgi_application
 # from whitenoise.django import DjangoWhiteNoise
 application = get_wsgi_application()
 # application = DjangoWhiteNoise(application)

I tried force loading models with an added dummy import in urls.py: from oscar.apps.order import models 我尝试通过在urls.py中from oscar.apps.order import models添加了虚拟导入来强制加载from oscar.apps.order import models

Starting to think it might be an issue with Heroku/wsgi files 开始认为这可能与Heroku / wsgi文件有关

我通过以下方式导入来修复它:

from oscar.app import application as shop

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

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