GithubHelp home page GithubHelp logo

apache-flask-wsgi's Introduction

apache-flask-wsgi

Description

Apache WSGI config to host multiple Flask sites

  • Multithreaded
  • Applications are in their own directories
  • Each has their own virtualenv
  • Apache listens on port 80 or port 443 and each site is a sub directory:
http://<IP>/app1
http://<IP>/app2
http://<IP>/app3

Results

Example includes 3 Flask sites all with the same page:

app1/
  * result: Hello World from app1!
app2/
  * result: Hello World from app2!
app3/
  * result: Hello World from app3!

Prerequisites

  • yum install httpd mod_wsgi.x86_64

Postrequisites

  • create venv for each application and pip install flask
cd /var/www/wsgi/app1; virtualenv venv; source venv/bin/activate; pip install flask

For SSL, you can generate a private key and crt:

[root@dropbox flask-https]# openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt
Generating a 2048 bit RSA private key
.....................................................................+++
...................................+++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:US
State or Province Name (full name) []:VT
Locality Name (eg, city) [Default City]:Burlington
Organization Name (eg, company) [Default Company Ltd]:IPAs for Everyone
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:flask
Email Address []:

Then place server.key and server.crt in /etc/ssl/crt/

Files

  • wsgi.conf - put in /etc/httpd/conf.d/ for HTTP config
  • wsgi-ssl.conf - put in /etc/httpd/conf.d/ for SSL config
  • ssl.conf - example ssl.conf to put in /etc/httpd/conf.d/ for SSL config
  • app(x)/app.wsgi - wsgi config for site app
  • app(x)/app.py - flask site for app

apache-flask-wsgi's People

Contributors

bmike78 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.