Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku Web Server Won't Start Locally

Tags:

python

heroku

I am having problems starting heroku web server localy. Here is the error message I am constantlly getting:

PS C:\Users\Dragan\heroku_workspace\python-getting-started> heroku local
[OKAY] Loaded ENV .env File as KEY=VALUE Format
10:01:32 web.1   |  Traceback (most recent call last):
10:01:32 web.1   |    File "c:\users\dragan\anaconda3\lib\runpy.py", line 170, in _run_module_as_main
10:01:32 web.1   |      "__main__", mod_spec)
10:01:32 web.1   |    File "c:\users\usr1\anaconda3\lib\runpy.py", line 85, in _run_code
10:01:32 web.1   |      exec(code, run_globals)
10:01:32 web.1   |    File 
C:\Users\Dragan\Anaconda3\Scripts\gunicorn.exe\__main__.py", line 5, in <module>
10:01:32 web.1   |    File "c:\users\dragan\anaconda3\lib\site-packages\gunicorn\app\wsgiapp.py", line 10, in <module>
10:01:32 web.1   |      from gunicorn.app.base import Application
10:01:32 web.1   |    File "c:\users\dragan\anaconda3\lib\site-packages\gunicorn\app\base.py", line 12, in <module>
10:01:32 web.1   |      from gunicorn import util
10:01:32 web.1   |    File "c:\users\dragan\anaconda3\lib\site-packages\gunicorn\util.py", line 9, in <module>
10:01:32 web.1   |      import fcntl
10:01:32 web.1   |  ImportError: No module named 'fcntl'
[DONE] Killing all processes with signal  null
10:01:33 web.1   Exited with exit code 1

I am following every step described in this tutorial LINK I installed the virtual environment inside the project 'python-getting-started'. I am trying to start the local web server from the project's root directory.

Can anybody help me resolve this issue?

UPDATE_1: I have installed Heroku Toolbelt for Windows, and I have installed Anaconda for Python.

like image 771
Adam Avatar asked Aug 13 '16 08:08

Adam


2 Answers

According to the Heroku tutorial, try this in Windows instead of heroku local:

heroku local web -f Procfile.windows

https://devcenter.heroku.com/articles/getting-started-with-python#run-the-app-locally

like image 67
vkc Avatar answered Sep 27 '22 17:09

vkc


You are trying to deploy a Python web application to Heroku using the gunicorn web server. This works great on Heroku, but CANNOT WORK on Windows because gunicorn only runs on *nix based operating systems.

What you can do instead of running heroku local is run your web server WITHOUT gunicorn locally. Simply say something like $ python myapp.py or whatever your main python web server file is. That will start your server locally using Python ONLY, and not gunicorn.

like image 24
rdegges Avatar answered Sep 27 '22 17:09

rdegges