add heroku/deploy options to quickstart, and add more clear links in tutorial setup.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kevin Burke · committed by Kevin Burke · parent 7ed3cba · Browse files · 2 files·+46 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+46 added−10 removed
- other:+46 added−10 removed
Provenance
- Commit
6b9e6a5- Tree
d1ff04e- Author
Kevin Burke <kevin@twilio.com>- Committer
Kevin Burke <kevin@twilio.com>- Parent
7ed3cba
2 files changed+46 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+36 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+Share your Local Server with a Friend831+-------------------------------------832+833+`Localtunnel <http://progrium.com/localtunnel/>`_ is a neat tool you can use to834+quickly share your local Flask server to a friend.835+836+To install Localtunnel, open a terminal and run the following command::837+838+ sudo gem install localtunnel839+840+Then, with Flask running at ``http://localhost:5000``, open a new Terminal window841+and type::842+843+ localtunnel 5000844+ Port 5000 is now publicly accessible from http://54xy.localtunnel.com ...845+846+*(Get a* ``gem: command not found`` *error? Download RubyGems*847+`here <http://rubygems.org/pages/download>`_ *.)*848+849+If you load the URL given in the localtunnel output in your browser, you850+should see your Flask app. It's actually being loaded from your own computer!851+852+Deploying to a Web Server853+-------------------------854+855+`Heroku <http://www.heroku.com>`_ offers a free web platform to host your856+Flask app, and is the easiest way for you to put your Flask app online.857+They have excellent instructions on how to deploy your Flask app `here858+<http://devcenter.heroku.com/articles/python>`_.859+860+Other resources for deploying Flask apps:861+862+- `Deploying Flask on ep.io <https://www.ep.io/docs/quickstart/flask/>`_863+- `Deploying Flask on Webfaction <http://flask.pocoo.org/snippets/65/>`_864+- `Deploying Flask on Google App Engine <https://github.com/kamalgill/flask-appengine-template>`_