我正在尝试在 Windows 环境中使用 heroku 和 waitress 包来托管我的 django 应用程序。我已经定义了运行 wsgi 应用程序的配置文件。我需要在哪里定义正确的端口并运行 heroku 应用程序?
这适用于运行 django app 和 heroku 的新 Windows 服务器。过去,我曾尝试在 procfile 上定义各种端口号来运行该应用程序,但它不起作用并显示权限错误。
档案:
web: waitress-serve --port=80 ACE:wsgi.application
我希望 django 应用程序使用命令在 heroku inn 浏览器上运行
-heroku local web
我得到的输出是:
[OKAY] Loaded ENV .env File as KEY=VALUE Format
16:15:41 web.1 | Traceback (most recent call last):
16:15:41 web.1 | File "c:\users\ramakrishnan_k\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in _run_module_as_main
16:15:41 web.1 | "__main__", mod_spec)
16:15:41 web.1 | File "c:\users\ramakrishnan_k\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in _run_code
16:15:41 web.1 | exec(code, run_globals)
16:15:41 web.1 | File "C:\Users\ramakrishnan_k\AppData\Local\Programs\Python\Python36-32\Scripts\waitress-serve.exe\__main__.py", line 9, in <module>
16:15:41 web.1 | File "c:\users\ramakrishnan_k\appdata\local\programs\python\python36-32\lib\site-packages\waitress\runner.py", line 279, in run
16:15:41 web.1 | _serve(app, **kw)
16:15:41 web.1 | File "c:\users\ramakrishnan_k\appdata\local\programs\python\python36-32\lib\site-packages\waitress\__init__.py", line 11, in serve
16:15:41 web.1 | server = _server(app, **kw)
16:15:41 web.1 | File "c:\users\ramakrishnan_k\appdata\local\programs\python\python36-32\lib\site-packages\waitress\server.py", line 85, in create_server
16:15:41 web.1 | sockinfo=sockinfo)
16:15:41 web.1 | File "c:\users\ramakrishnan_k\appdata\local\programs\python\python36-32\lib\site-packages\waitress\server.py", line 229, in __init__
16:15:41 web.1 | self.bind_server_socket()
16:15:41 web.1 | File "c:\users\ramakrishnan_k\appdata\local\programs\python\python36-32\lib\site-packages\waitress\server.py", line 360, in bind_server_socket
16:15:41 web.1 | self.bind(sockaddr)
16:15:41 web.1 | File "c:\users\ramakrishnan_k\appdata\local\programs\python\python36-32\lib\site-packages\waitress\wasyncore.py", line 369, in bind
16:15:41 web.1 | return self.socket.bind(addr)
16:15:41 web.1 | OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
16:15:41 web.1 | C:\Users\ramakrishnan_k\Desktop\Dock\static/ static path
16:15:41 web.1 | C:\Users\ramakrishnan_k\Desktop\Dock\media media rooot
16:15:41 web.1 Exited with exit code 1
这是错误的。
预期的输出应该为您提供 env 和 procfile 状态的正常状态,并在浏览器中运行 heroku 应用程序。