Commit 12e19441 authored by omeyer99's avatar omeyer99
Browse files

edited code

parent 3174f5f4
...@@ -10,8 +10,9 @@ Dependencies are automatically installed when FLask will be installed. So the ne ...@@ -10,8 +10,9 @@ Dependencies are automatically installed when FLask will be installed. So the ne
After you successfully installed Python, the next step is to deploy your first Flask Application. Let's start with an Basic Application, which looks like this. After you successfully installed Python, the next step is to deploy your first Flask Application. Let's start with an Basic Application, which looks like this.
``` ```python
from flask import Flask from flask import Flask
app = Flask(__name__) app = Flask(__name__)
@app.route('/') @app.route('/')
...@@ -28,8 +29,8 @@ First, lets talk about the code. ...@@ -28,8 +29,8 @@ First, lets talk about the code.
As you understand what we did we can safe the app as `app.py` for example. To run the application you can use either the `flask` command or the python's `-m` switch. But first you need to tell your terminal the application to work with by exporting the `FLASK_APP` environment variable: As you understand what we did we can safe the app as `app.py` for example. To run the application you can use either the `flask` command or the python's `-m` switch. But first you need to tell your terminal the application to work with by exporting the `FLASK_APP` environment variable:
``` ```bash
$ export FLASK_APP=hello.py $ export FLASK_APP=hello.py
$ flask run $ flask run
* Running on http://127.0.0.1:5000/ * Running on http://127.0.0.1:5000/
``` ```
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Modern web applications use meaningful URLs to help users. Users are more likely to like a page and come back if the page uses a meaningful URL they can remember and use to directly visit a page. Modern web applications use meaningful URLs to help users. Users are more likely to like a page and come back if the page uses a meaningful URL they can remember and use to directly visit a page.
Use the **route()** decorator to bind a function to a URL. Use the **route()** decorator to bind a function to a URL.
``` ```python
@app.route('/') @app.route('/')
def index(): def index():
return 'Index Page' return 'Index Page'
...@@ -16,7 +16,7 @@ def hello(): ...@@ -16,7 +16,7 @@ def hello():
## Variable Rules ## Variable Rules
You can add variable sections to a URL by marking sections with `<variable_name>`. Your function then receives the `<variable_name>` as a keyword argument. Optionally, you can use a converter to specify the type of the argument like `<converter:variable_name>`. You can add variable sections to a URL by marking sections with `<variable_name>`. Your function then receives the `<variable_name>` as a keyword argument. Optionally, you can use a converter to specify the type of the argument like `<converter:variable_name>`.
``` ```python
from markupsafe import escape from markupsafe import escape
@app.route('/user/<username>') @app.route('/user/<username>')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment