||3 years ago|
|routes||3 years ago|
|sass||3 years ago|
|static||3 years ago|
|tmp||3 years ago|
|views||3 years ago|
|.gitignore||3 years ago|
|app.py||3 years ago|
|passenger_wsgi.py||3 years ago|
|readme.md||3 years ago|
|requirements.txt||3 years ago|
|site.cfg||3 years ago|
Flask Starter Web Application
In this repo is flask web-app skeleton for a basic API or Flask powered website. The stylesheets are Sassy and Bootstrap 4 is included in the Sass libs folder. Everything you need here (except a Sass precompiler) to get started with a Flask App along with deployment instructions for Dreamhost.
- Python (preferrably Python3)
- pip package manager
- Virtualenv for managing virtual environments (installed via pip)
- SASS/SCSS compiler (or not, it's up to you. My SASS files are included in the repo.)
- Clone this repository
git clone firstname.lastname@example.org:trev-dev/flask-starter.git
- Enter the flask-starter directory
- Setup your virtual environment (virtualenv) and activate your env.
virtualenv env source ./env/bin/activate
- When you see the little (env) indicator on your terminal, install the python package dependancies.
pip install -r requirements.txt
- Launch the app and preview it in your browser on localhost:5000.
- Edit/change/develop your site using Flask + Jinja2 (Or whatever other templating you wish to use)
- Setup hosting for a domain and ensure you have passenger enabled for Python apps.
- Use FTP/SFTP to move your project to its destination on Dreamhost (/home/username/example.com). Be sure to avoid moving any caching or your env.
- Use a secure shell to log in to your dreamhost hosting and run the same steps to setup your pip and virtualenv. If your python is out of date on Dreamhost, you can update it/install your own version.
- Configure passenger_wsgi.py to tie-in passenger to your application - specifically the destination of the python file inside ./env/bin/python. You'll need to change the "website" and username in the INTERP string.
import sys, os INTERP = '/home/<username>/<website.com>/env/bin/python' if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv) sys.path.append(os.getcwd()) from app import app as application
- Wait a few minutes, then visit your website. It should be working. If not, Dreamhost has lots of documentation/support that can help you out. Enjoy!