title: Issue Running gunicorn to serve flask app
body: <p>objective:  get gunicorn to serve the flask app</p>
  
  <p>attempt: run the following command:</p>
  
  <pre><code>gunicorn [the name of my project folder]:flaskr
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>[2019-08-26 15:04:32 +0000] [16063] [INFO] Starting gunicorn 19.9.0
  [2019-08-26 15:04:32 +0000] [16063] [INFO] Listening at: http://127.0.0.1:8000 (16063)
  [2019-08-26 15:04:32 +0000] [16063] [INFO] Using worker: sync
  [2019-08-26 15:04:32 +0000] [16067] [INFO] Booting worker with pid: 16067
  [2019-08-26 15:04:32 +0000] [16067] [ERROR] Exception in worker process
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
      worker.init_process()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 129, in init_process
      self.load_wsgi()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
      self.wsgi = self.app.wsgi()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
      self.callable = self.load()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
      return self.load_wsgiapp()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
      return util.import_app(self.app_uri)
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 350, in import_app
      __import__(module)
  ImportError: No module named [the name of my project folder]
  [2019-08-26 15:04:32 +0000] [16067] [INFO] Worker exiting (pid: 16067)
  [2019-08-26 15:04:32 +0000] [16063] [INFO] Shutting down: Master
  [2019-08-26 15:04:32 +0000] [16063] [INFO] Reason: Worker failed to boot.
  </code></pre>
  
  <p>I have deployed this project to my web server.  In the home directory of the account I am using to administer this webserver, I have the project folder as I was working on it from my workstation.  Here is the tree output ran from within the project folder:</p>
  
  <pre><code>├── flaskr
  │   ├── auth.py
  │   ├── build
  │   ├── db.py
  │   ├── db.pyc
  │   ├── dist
  │   ├── flaskr.egg-info
  │   ├── __init__.py
  │   ├── __init__.pyc
  │   ├── MANIFEST.in
  │   ├── old
  │   ├── __pycache__
  │   ├── schema.sql
  │   ├── setup.py
  │   ├── static
  │   └── templates
  ├── instance
  │   └── flaskr.sqlite
  ├── keys.csv
  ├── tests
  ├── venv
  │   ├── bin
  │   ├── include
  │   ├── lib
  │   ├── lib64
  │   ├── pyvenv.cfg
  │   └── share
  └── venv.sh
  </code></pre>
  
  <p>I have installed gunicorn in the venv.  I also exported the environment variables as shown in the flask tutorial.</p>
  
  <p>I have also configured manifest.ini and setup.py to make the program installable.  I have attempted to install by running the following from within the project folder:</p>
  
  <pre><code>pip install -e
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>Usage:   
    pip install [options] &lt;requirement specifier&gt; [package-index-options] ...
    pip install [options] -r &lt;requirements file&gt; [package-index-options] ...
    pip install [options] [-e] &lt;vcs project url&gt; ...
    pip install [options] [-e] &lt;local project path&gt; ...
    pip install [options] &lt;archive url/path&gt; ...
  
  -e option requires an argument
  </code></pre>
  
  <p>I have verified that the app itself is running on my workstation after using "flask run".</p>
  
  <p>If you need code for any of the files, please let me know and the best way to share.  Here is some code that I think it relevant for now:</p>
  
  <p>setup.py:</p>
  
  <pre><code>from setuptools import find_packages, setup
  
  setup(
      name='flaskr',
      version='1.0.0',
      packages=find_packages(),
      include_package_data=True,
      zip_safe=False,
      install_requires=[
          'flask',
      ],
  )
  </code></pre>
  
  <p>manifest.in:</p>
  
  <pre><code>include flaskr/schema.sql
  graft flaskr/static
  graft flaskr/templates
  global-exclude *.pyc
  </code></pre>
  
  <p>EDIT: 8/26/19 - 1:30 pm:</p>
  
  <p>I have attempted to discover the cause of this issue by following another article, <a href="https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-14-04" rel="nofollow noreferrer">https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-14-04</a>
  When I run this command:</p>
  
  <pre><code>gunicorn --bind 0.0.0.0:8000 wsgi
  </code></pre>
  
  <p>output: </p>
  
  <pre><code>[2019-08-26 17:23:14 +0000] [17748] [INFO] Starting gunicorn 19.9.0
  [2019-08-26 17:23:14 +0000] [17748] [INFO] Listening at: http://0.0.0.0:8000 (17748)
  [2019-08-26 17:23:14 +0000] [17748] [INFO] Using worker: sync
  [2019-08-26 17:23:14 +0000] [17752] [INFO] Booting worker with pid: 17752
  [2019-08-26 17:23:15 +0000] [17752] [ERROR] Exception in worker process
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
      worker.init_process()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 129, in init_process
      self.load_wsgi()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
      self.wsgi = self.app.wsgi()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
      self.callable = self.load()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
      return self.load_wsgiapp()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
      return util.import_app(self.app_uri)
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 350, in import_app
      __import__(module)
    File "/home/[my user name]/[name of the project folder]/wsgi.py", line 1, in &lt;module&gt;
      from [name of the project folder] import app
  ImportError: No module named [name of the project folder]
  [2019-08-26 17:23:15 +0000] [17752] [INFO] Worker exiting (pid: 17752)
  [2019-08-26 17:23:15 +0000] [17748] [INFO] Shutting down: Master
  [2019-08-26 17:23:15 +0000] [17748] [INFO] Reason: Worker failed to boot.
  </code></pre>
  
  <p>Here is the wsgi.py:</p>
  
  <pre><code>from [the name of my project folder] import app
  
  if __name__ == "__main__":
      app.run()
  </code></pre>
  
  <p>I suspect I am naming the wrong thing in my wsgi.py</p>