尝试在Heroku上部署Django应用程序时出现服务器错误

时间:2015-08-27 21:12:24

标签: python django heroku

我在尝试使用Heroku部署Django应用程序时遇到问题(即我收到服务器错误500)。我不知道从哪里开始调试根据日志问题是默认代码而不是我写的代码。希望额外的一双眼睛可以提供帮助。

do-while

wsgi.py:

boolean end = false;

//code

do
{
   try{
       input = user_input.nextInt();
       end = true;
   }catch(InputMisMatchException ex)
       System.out.println("An error ocurred");
       end = false;
       System.out.println("Try again");
       input.nextLine();
   }
}while(end == false);

设置/ base.py:

from tkinter import *

class MainWindow(Tk):

    def __init__(self):
        Tk.__init__(self)

    def SetEnableStatus(self, status):
        for w in self.winfo_children():
            if status == False:
                w.grab_set()
            else:
                w.grab_release()

    def CreateChildWindow(self):            
        subWindow = Toplevel(self)

        def quit_subwindow():
            subWindow.destroy()
            self.SetEnableStatus(True) # Enable all widgets of main window

        Button(subWindow, text='Exit', command=quit_subwindow).pack()

        self.SetEnableStatus(False) # Disable all widgets of main window

settings / production.py:(继承自base.py)

2015-08-27T20:39:31.670018+00:00 app[web.1]:     django.setup()
2015-08-27T20:39:31.670012+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 356, in import_app
2015-08-27T20:39:31.670020+00:00 app[web.1]:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-08-27T20:39:31.670022+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
2015-08-27T20:39:31.670019+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 17, in setup
2015-08-27T20:39:31.670024+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
2015-08-27T20:39:31.670023+00:00 app[web.1]:     self._setup(name)
2015-08-27T20:39:31.670042+00:00 app[web.1]:     self._wrapped = Settings(settings_module)
2015-08-27T20:39:31.670051+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
2015-08-27T20:39:31.670052+00:00 app[web.1]:     mod = importlib.import_module(self.SETTINGS_MODULE)
2015-08-27T20:39:31.670053+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 30, in import_module
2015-08-27T20:39:31.670054+00:00 app[web.1]:     raise TypeError("relative imports require the 'package' argument")
2015-08-27T20:39:31.670055+00:00 app[web.1]: TypeError: relative imports require the 'package' argument
2015-08-27T20:39:31.670056+00:00 app[web.1]: Traceback (most recent call last):
2015-08-27T20:39:31.670057+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
2015-08-27T20:39:31.670058+00:00 app[web.1]:     worker.init_process()
2015-08-27T20:39:31.670059+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 114, in init_process
2015-08-27T20:39:31.670061+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2015-08-27T20:39:31.670062+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 66, in wsgi
2015-08-27T20:39:31.670064+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2015-08-27T20:39:31.670063+00:00 app[web.1]:     self.callable = self.load()
2015-08-27T20:39:31.670066+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2015-08-27T20:39:31.670067+00:00 app[web.1]:     return util.import_app(self.app_uri)
2015-08-27T20:39:31.670068+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 356, in import_app
2015-08-27T20:39:31.670069+00:00 app[web.1]:     __import__(module)
2015-08-27T20:39:31.670070+00:00 app[web.1]:   File "/app/resume_app/wsgi.py", line 32, in <module>
2015-08-27T20:39:31.670071+00:00 app[web.1]:     application = Cling(get_wsgi_application())
2015-08-27T20:39:31.670072+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
2015-08-27T20:39:31.670065+00:00 app[web.1]:     return self.load_wsgiapp()
2015-08-27T20:39:31.670076+00:00 app[web.1]:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2015-08-27T20:39:31.670077+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
2015-08-27T20:39:31.670078+00:00 app[web.1]:     self._setup(name)
2015-08-27T20:39:31.670074+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 17, in setup
2015-08-27T20:39:31.670073+00:00 app[web.1]:     django.setup()
2015-08-27T20:39:31.670079+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
2015-08-27T20:39:31.670084+00:00 app[web.1]:     raise TypeError("relative imports require the 'package' argument")
2015-08-27T20:39:31.670080+00:00 app[web.1]:     self._wrapped = Settings(settings_module)
2015-08-27T20:39:31.670081+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
2015-08-27T20:39:31.670082+00:00 app[web.1]:     mod = importlib.import_module(self.SETTINGS_MODULE)
2015-08-27T20:39:31.670083+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 30, in import_module
2015-08-27T20:39:31.670085+00:00 app[web.1]: TypeError: relative imports require the 'package' argument
2015-08-27T20:39:31.670092+00:00 app[web.1]: [2015-08-27 20:39:31 +0000] [10] [INFO] Worker exiting (pid: 10)
2015-08-27T20:39:31.703669+00:00 app[web.1]: [2015-08-27 20:39:31 +0000] [3] [INFO] Shutting down: Master
2015-08-27T20:39:31.703754+00:00 app[web.1]: [2015-08-27 20:39:31 +0000] [3] [INFO] Reason: Worker failed to boot.
2015-08-27T20:39:32.422322+00:00 heroku[web.1]: Process exited with status 3
2015-08-27T20:39:32.432936+00:00 heroku[web.1]: State changed from up to crashed
2015-08-27T20:44:13.794339+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=stormy-depths-4606.herokuapp.com request_id=934e2666-44a5-46f2-b61b-441943034457 fwd="204.209.24.2" dyno= connect= service= status=503 bytes=
2015-08-27T20:46:23.349023+00:00 heroku[slug-compiler]: Slug compilation started
2015-08-27T20:46:23.349046+00:00 heroku[slug-compiler]: Slug compilation finished
2015-08-27T20:46:23.295469+00:00 heroku[api]: Deploy 7dd6665 by MYEMAIL
2015-08-27T20:46:23.295570+00:00 heroku[api]: Release v20 created by MYEMAIL
2015-08-27T20:46:23.821752+00:00 heroku[web.1]: State changed from crashed to starting
2015-08-27T20:46:29.236851+00:00 heroku[web.1]: Starting process with command `gunicorn resume_app.wsgi --log-file -`
2015-08-27T20:46:31.888340+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [3] [INFO] Starting gunicorn 19.1.1
2015-08-27T20:46:31.889532+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [3] [INFO] Using worker: sync
2015-08-27T20:46:31.979799+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [10] [INFO] Booting worker with pid: 10
2015-08-27T20:46:31.902030+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [9] [INFO] Booting worker with pid: 9
2015-08-27T20:46:31.889028+00:00 app[web.1]: [2015-08-27 20:46:31 +0000] [3] [INFO] Listening at: http://0.0.0.0:25282 (3)
2015-08-27T20:46:33.015239+00:00 heroku[web.1]: State changed from starting to up

非常感谢任何帮助。谢谢!

编辑:这是我的procfile:

import os
from django.core.wsgi import get_wsgi_application
from dj_static import Cling


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "resume_app.settings")
application = get_wsgi_application()

0 个答案:

没有答案