-
-
Save touchmenot/8290572 to your computer and use it in GitHub Desktop.
Revisions
-
mihkels revised this gist
Apr 25, 2013 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
mihkels created this gist
Apr 25, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ server { listen 80; server_name mywebapp; location /static { alias /home/user/projects/mywebapp/static; } location / { include uwsgi_params; uwsgi_pass unix:/tmp/mywebapp.sock; uwsgi_param UWSGI_PYHOME /home/user/projects/mywebapp/env; uwsgi_param UWSGI_CHDIR /home/user/projects/mywebapp; uwsgi_param UWSGI_MODULE mywebapp; uwsgi_param UWSGI_CALLABLE app; } error_page 404 /404.html; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ [uwsgi] plugins=python vhost=true socket=/tmp/mywebapp.sock This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run() This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #!/bin/bash sudo apt-get update # Now let's install all the required ubuntu packages sudo apt-get install build-essential uwsgi nginx uwsgi-plugin-python python-pip # PS! If you are doing this stuff for fun I do recommend to install nginx from PPA repository # that you can find here https://launchpad.net/~nginx/+archive/development # Now let's install virtualenv sudo pip install virtualenv This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #!/bin/bash PROJECT_BASE=$HOME/projects/webapp # Now we setup our sample website and virtual env mkdir $PROJECT_BASE mkdir $PROJECT_BASE/static sudo virtualenv $PROJECT_BASE/env # now we install Flask into our virtualenv source $PROJECT_BASE/env/bin/activate sudo pip install flask deactivate # Now we can create Nginx and uWSGI configuration files SERVER_CONF=/etc/nginx/sites-available APP=mywebapp sudo touch $SERVER_CONF/$APP sudo touch /etc/uwsgi/app-avialable/$APP.ini sudo ln -s $SERVER_CONF/$APP /etc/nginx/sites-enabled sudo ln -s /etc/uwsgi/app-available/$APP.ini /etc/uwsgi/app-enabled