By luishengjie8
I have created a Flask Application based on the Large Application Structure in Miguel Grinberg’s Flask Web Development Book. I have followed the tutorial in how-to-deploy-a-flask-application-on-an-ubuntu-vps and have managed to deploy a single file Flask application on my server. What changes/ modifications do I have to implement to my .wsgi file and apache config to be able to host Large Structured applications?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This question was answered by @lking:
there are some good ideas in http://www.enigmeta.com/2012/08/16/starting-flask/. The following were found to be in error, but still a good deployment model.
add
*.py[cod]to the.gitignorefile, actually maybe suggest picking up template from https://github.com/github/gitignore/blob/master/Python.gitignorereferences to
git@github.com:USERNAME/helloflask.gitdidn’t seem to work for me. I had to usehttps://github.com/USERNAME/helloflask.git, forgit remote add origin git@github.com:USERNAME/helloflask.gitandgit clone git@github.com:USERNAME/helloflask.gitthe fabfile.py needed some changes. Here is what worked for me. Note change on source bin/activate line, had to have pip install in same run command
from fabric.api import env, run, cd USERNAME = 'root' SERVER = 'helloflask.example.org' APP_NAME = 'helloflask' PROJECT_DIR = '/var/www/%s/%s' % (SERVER, APP_NAME) WSGI_SCRIPT = 'application.wsgi' env.hosts = ["%s@%s" % (USERNAME, SERVER)] def deploy(): with cd(PROJECT_DIR): run('git pull') run('source bin/activate; pip install -r requirements.txt') run('touch %s' % WSGI_SCRIPT)
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.