部署到heroku时更改我的应用程序名称所导致的问题

时间:2018-01-15 13:14:52

标签: python django git heroku

我的django应用程序的名称始终是锻炼。然后,当我开始部署它时,我认为将名称更改为 exercisecalendar 是一个好主意。所以我开始了一个新的git repo并将我的项目文件放在那里(没有启动一个新的django项目)。我更改的唯一内容是文件夹workout的名称(settings.py所在的django项目的第一个)到workoutcalendar以及更改DJANGO_SETTINGS_MODULE环境变量的名称。

现在,我遇到了问题。我的应用程序的某些部分似乎正在寻找一个他们无法找到的workout模块。例如:

2018-01-15T13:06:40.615612+00:00 app[web.1]: Traceback (most recent call last):
2018-01-15T13:06:40.615613+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 135, in handle
2018-01-15T13:06:40.615614+00:00 app[web.1]:     self.handle_request(listener, req, client, addr)
2018-01-15T13:06:40.615615+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
2018-01-15T13:06:40.615616+00:00 app[web.1]:     respiter = self.wsgi(environ, resp.start_response)
2018-01-15T13:06:40.615617+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 146, in __call__
2018-01-15T13:06:40.615618+00:00 app[web.1]:     response = self.get_response(request)
2018-01-15T13:06:40.615619+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/base.py", line 81, in get_response
2018-01-15T13:06:40.615620+00:00 app[web.1]:     response = self._middleware_chain(request)
2018-01-15T13:06:40.615621+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 37, in inner
2018-01-15T13:06:40.615622+00:00 app[web.1]:     response = response_for_exception(request, exc)
2018-01-15T13:06:40.615623+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 87, in response_for_exception
2018-01-15T13:06:40.615624+00:00 app[web.1]:     response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
2018-01-15T13:06:40.615626+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/core/handlers/exception.py", line 125, in handle_uncaught_exception
2018-01-15T13:06:40.615627+00:00 app[web.1]:     callback, param_dict = resolver.resolve_error_handler(500)
2018-01-15T13:06:40.615628+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/urls/resolvers.py", line 549, in resolve_error_handler
2018-01-15T13:06:40.615629+00:00 app[web.1]:     callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
2018-01-15T13:06:40.615629+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
2018-01-15T13:06:40.615630+00:00 app[web.1]:     res = instance.__dict__[self.name] = self.func(instance)
2018-01-15T13:06:40.615631+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/django/urls/resolvers.py", line 529, in urlconf_module
2018-01-15T13:06:40.615632+00:00 app[web.1]:     return import_module(self.urlconf_name)
2018-01-15T13:06:40.615633+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2018-01-15T13:06:40.615634+00:00 app[web.1]:     return _bootstrap._gcd_import(name[level:], package, level)
2018-01-15T13:06:40.615635+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2018-01-15T13:06:40.615638+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
2018-01-15T13:06:40.615636+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2018-01-15T13:06:40.615639+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2018-01-15T13:06:40.615640+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2018-01-15T13:06:40.615640+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2018-01-15T13:06:40.615641+00:00 app[web.1]:   File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2018-01-15T13:06:40.615717+00:00 app[web.1]: 10.31.130.110 - - [15/Jan/2018:13:06:40 +0000] "GET /favicon.ico HTTP/1.1" 500 - "-" "-"
2018-01-15T13:06:40.615642+00:00 app[web.1]: ModuleNotFoundError: No module named 'workout'

我不知道如何更改项目的所有相关部分。提及workout的地方在哪里,我需要将其更改为workoutcalendar

1 个答案:

答案 0 :(得分:1)

问题可能是settings.py中的ROOT_URLCONF

ROOT_URLCONF = 'workoutcalendar.urls'

如果您在此之后仍然遇到问题,请在项目目录中运行git grep workout并查看匹配项,以查看是否还有其他更改。