flasky-appengine
flasky + appengine FTW!
This repo is based on the excellent flasky project. It has been modified to be compatible with Google App Engine.
Prerequisites
- Install the Google Cloud SDK, including the gcloud tool, and gcloud app component.
- Install MySQL
- Install virtualenvwrapper
pip install virtualenvwrapper
- Sign up for a Google Cloud Platform project, and set up a Cloud SQL instance, as described here, and a Cloud Storage bucket, as described here. You'll want to configure your Cloud SQL instance in the config.py. To keep costs down, we suggest signing up for a D0 instance with package billing.
- Visit your project in the
Google Cloud Console, going to the App Engine section's Application Settings
area, and make a note of the Service Account Name for your application, which has an e-mail address
(e.g.
<PROJECT_ID>@appspot.gserviceaccount.com
). Then, visit the Cloud Storage section of your project, select the checkbox next to the bucket you created in step 3, click Bucket Permissions, and add your Service Account Name as a User account that has Writer permission.
Run Locally
-
Setup the gcloud tool.
gcloud components update app gcloud auth login gcloud config set project <your-app-id>
You don't need a valid app-id to run locally, but will need a valid id to deploy below.
-
Clone this repo.
git clone https://github.com/russomi/flasky-appengine.git
-
Create a virtual environment
mkvirtualenv flasky-appengine
-
Install requirements.txt
pip install -r requirements/dev.txt pip install -t lib -r requirements/common.txt
Tip:
- If the library is provided by the google app engine environment,
pip install
into the virtualenv. - If the library is not provided by the google app engine environment,
pip install -t lib
directory.
- If the library is provided by the google app engine environment,
-
Add google_appengine sdk and lib folder to the virtualenv:
add2virtualenv lib add2virtualenv ~/google-cloud-sdk/platform/google_appengine
-
Run this project locally from the command line.
gcloud preview app run flasky-appengine/
-
Visit the application at http://localhost:8080.
Deploying
-
Use the Cloud Developer Console to create a project/app id. (App id and project id are identical)
-
Configure gcloud with your app id.
gcloud config set project <your-app-id>
-
Use the Admin Console to view data, queues, and other App Engine specific administration tasks.
-
Use gcloud to deploy your app.
gcloud preview app deploy flasky-appengine/
-
Congratulations! Your application is now live at your-app-id.appspot.com
Contributing changes
- See CONTRIBUTING.md
Licensing
- See LICENSE