Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Please add install instructions with Apache #11

Open
JDJoe opened this issue Jan 21, 2020 · 1 comment
Open

Request: Please add install instructions with Apache #11

JDJoe opened this issue Jan 21, 2020 · 1 comment

Comments

@JDJoe
Copy link

JDJoe commented Jan 21, 2020

  1. Directory structure
  2. if any files need to be edited (403 FORBIDDEN #8)
  3. if any files need to be moved
  4. sample Apache virtual host config

Something like:

<VirtualHost *:80>
		ServerName mywebsite.com
		ServerAdmin admin@mywebsite.com
		WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi 
		<Directory /var/www/FlaskApp/FlaskApp/>
			Order allow,deny
			Allow from all
		</Directory>
		Alias /static /var/www/FlaskApp/FlaskApp/static
		<Directory /var/www/FlaskApp/FlaskApp/static/>
			Order allow,deny
			Allow from all
		</Directory>
		ErrorLog ${APACHE_LOG_DIR}/error.log
		LogLevel warn
		CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

@JDJoe
Copy link
Author

JDJoe commented Jan 21, 2020

I used this as help https://dev.to/sm0ke/flask-deploy-with-apache-on-centos-minimal-setup-2kb7 and I got it up and running on with Apache on Ubuntu VPS at digitalocean.

BTW, I had to rename the webhook-bot.py to webhookbot.py because hyphen was causing problems.

flaskapp.wsgi looks like this:

#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/FlaskBot/") 

from webhookbot import app as application
application.secret_key = 'putsomethinghere'

wsgi.py looks like this:

#!/usr/bin/env python

import sys
import site

site.addsitedir('/var/www/FlaskBot/lib/python3.6/site-packages')

sys.path.insert(0, '/var/www/FlaskBot')

from webhookbot import app as application

your apache vhost conf needs:

...
               WSGIDaemonProcess hitme user=www-data group=www-data threads=2
                WSGIScriptAlias / /var/www/FlaskBot/wsgi.py
                <Directory /var/www/FlaskBot/>
                        Order allow,deny
                        Allow from all
                </Directory>
...

You probably want to create a new user just for this app and chown the files and change it in your apache config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant