我一直在跟随本教程在Digital Ocean上部署我的django网站。我刚刚上传了所有文件并重新启动了gunicorn。该网站给出了我的错误:
ImportError at / No module named braces.views
这是追溯:
Traceback Switch to copy-and-paste view
/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py in inner
response = get_response(request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _legacy_get_response
response = self._get_response(request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _get_response
resolver_match = resolver.resolve(request.path_info) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py in resolve
for pattern in self.url_patterns: ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/utils/functional.py in __get__
res = instance.__dict__[self.name] = self.func(instance) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/utils/functional.py in __get__
res = instance.__dict__[self.name] = self.func(instance) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py in urlconf_module
return import_module(self.urlconf_name) ...
▶ Local vars
/usr/lib/python2.7/importlib/__init__.py in import_module
__import__(name) ...
▶ Local vars
/usr/lib/python2.7/dist-packages/gevent/builtins.py in __import__
result = _import(*args, **kwargs) ...
▶ Local vars
/home/django/django_project/django_project/urls.py in <module>
from blog import views ...
▶ Local vars
/usr/lib/python2.7/dist-packages/gevent/builtins.py in __import__
result = _import(*args, **kwargs) ...
▶ Local vars
/home/django/django_project/blog/views.py in <module>
from braces.views import SelectRelatedMixin ...
▶ Local vars
/usr/lib/python2.7/dist-packages/gevent/builtins.py in __import__
result = _import(*args, **kwargs) ...
▶ Local vars
我完全不知道问题是什么。我只是在开发应用程序时弄清楚我的Django问题,但是现在我正在尝试部署网站并且不得不使用实时服务器,我觉得我从正方形开始...请帮忙!
答案 0 :(得分:1)
我只需在服务器上运行 //Automapper config
Mapper.Initialize(cfg =>
{
//Initializes all mapping profiles in the assembly
cfg.AddProfiles(Assembly.GetExecutingAssembly().GetName().Name);
//If map is called without a profile creates default map
cfg.CreateMissingTypeMaps = true;
});