-
Notifications
You must be signed in to change notification settings - Fork 18
Introduction to Flask and Python
morgajel edited this page Sep 3, 2014
·
2 revisions
This is intended as a quick overview of the new layout associated with flask.
Now that we are using a python backend, you need to have python, virtualenv, and sqlite available (installation is beyond the scope of this document; I'm including ubuntu-based instructions as a baseline).
# Install packages for ubuntu; skip this if it doesn't apply
sudo apt-get install python python-virtualenv git git-flow
git clone git@github.com:MultiverseMiner/multiverseminer.git
cd multiverseminer
virtualenv env
source env/bin/activate
if using another branch, git checkout here.
pip install -r requirements.txt -r Testing-requirements.txt
cp config.py.sample config.py
Make sure to set your google auth keys here
py.test
./db_migrate.py db init
./db_migrate.py db migrate
./db_migrate.py db upgrade
There are two ways to start the app: debug mode (good for debugging):
./run.py
or production mode:
gunicorn mm:app
The actual layout is quite simple-
.
├── mm
│ ├── static
│ │ ├── css
│ │ ├── images
│ │ ├── js
│ │ └── gen
│ └── templates
├── data
├── env
└── tests
- mm/: base directory of the application
- mm/static/: for css, js and other non-dynamic files
- mm/static/gen/: directory for dynamically minified js and css
- mm/templates/: directory for templated HTML files.
- data/: location for storing static data (like Item data)
- env/: directory for virtualenv (you'll never need to venture in here)
- tests/: unit tests are kept here.