Merge pull request #427 from kevinburke/fix-existing-tutorial
Before adoption: this commit came in with the history the project adopted, so no landing records it.
add heroku/deploy options to quickstart, and add clearer links in tutorial setup
authored by Ron DuPlain · committed by Ron DuPlain · parents 4e9b786, 2befab2 · Browse files · 2 files·+26 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+26 added−10 removed
- other:+26 added−10 removed
Provenance
- Commit
1d1db80- Tree
86312fb- Author
Ron DuPlain <ron.duplain@gmail.com>- Committer
Ron DuPlain <ron.duplain@gmail.com>- Parent 1
4e9b786- Parent 2
2befab2
2 files changed+26 added−10 removed
modified:docs/tutorial/setup.rst+10 added-10 removed
9 unmodified lines10 into the module which we will be doing here. However a cleaner solution11 would be to create a separate `.ini` or `.py` file and load that or import12 the values from there.13 14-::14+In `flaskr.py`::15 16 # all the imports17 import sqlite318 from flask import Flask, request, session, g, redirect, url_for, \6 unmodified lines25 USERNAME = 'admin'26 PASSWORD = 'default'27 28 Next we can create our actual application and initialize it with the29-config from the same file::29+config from the same file, in `flaskr.py`::30 31 # create our little application :)32 app = Flask(__name__)33 app.config.from_object(__name__)2 unmodified lines36 string it will import it) and then look for all uppercase variables37 defined there. In our case, the configuration we just wrote a few lines38 of code above. You can also move that into a separate file.39 40-It is also a good idea to be able to load a configuration from a41-configurable file. This is what :meth:`~flask.Config.from_envvar` can42-do::40+Usually, it is a good idea to load a configuration from a configurable41+file. This is what :meth:`~flask.Config.from_envvar` can do, replacing the42+:meth:`~flask.Config.from_object` line above::43 44 app.config.from_envvar('FLASKR_SETTINGS', silent=True)45 46 That way someone can set an environment variable called47-:envvar:`FLASKR_SETTINGS` to specify a config file to be loaded which will48-then override the default values. The silent switch just tells Flask to49-not complain if no such environment key is set.47+:envvar:`FLASKR_SETTINGS` to specify a config file to be loaded which will then48+override the default values. The silent switch just tells Flask to not complain49+if no such environment key is set.50 51 The `secret_key` is needed to keep the client-side sessions secure.52 Choose that key wisely and as hard to guess and complex as possible. The53-debug flag enables or disables the interactive debugger. Never leave54-debug mode activated in a production system because it will allow users to53+debug flag enables or disables the interactive debugger. *Never leave54+debug mode activated in a production system*, because it will allow users to55 execute code on the server!56 57 We also add a method to easily connect to the database specified. That58 can be used to open a connection on request and also from the interactive32 unmodified linesmodified:docs/quickstart.rst+16 added
824 unmodified lines825 can do it like this::826 827 from werkzeug.contrib.fixers import LighttpdCGIRootFix828 app.wsgi_app = LighttpdCGIRootFix(app.wsgi_app)829+830+Deploying to a Web Server831+-------------------------832+833+If you want to make your Flask app available to the Internet at large, `Heroku834+<http://www.heroku.com>`_ is very easy to set up and will run small Flask835+applications for free. `Check out their tutorial on how to deploy Flask apps on836+their service <http://devcenter.heroku.com/articles/python>`_.837+838+There are a number of other websites that will host your Flask app and make it839+easy for you to do so.840+841+- `Deploying Flask on ep.io <https://www.ep.io/docs/quickstart/flask/>`_842+- `Deploying Flask on Webfaction <http://flask.pocoo.org/snippets/65/>`_843+- `Deploying Flask on Google App Engine <https://github.com/kamalgill/flask-appengine-template>`_844+- `Sharing your Localhost Server with Localtunnel <http://flask.pocoo.org/snippets/89/>`_