You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: turning-a-script-into-a-website.md
+30-11Lines changed: 30 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,11 +67,29 @@ the theory is the same.
67
67
68
68
### Step 2: create a website
69
69
70
+
Firstly, [create a PythonAnywhere account](https://www.pythonanywhere.com/pricing/) if you haven't already. A free "Beginner" account is enough for this tutorial.
71
+
72
+
Once you've signed up, you'll be taken to the dashboard, with a tour window. It's worth going through
73
+
the tour so that you can learn how the site works -- it'll only take a minute or so.
This page is asking you where you want to put your code. Code on PythonAnywhere is stored in your home directory, `/home/`*yourusername*, and in its subdirectories. Now, Flask is a particularly lighweight framework, and you can write a simple Flask app in a single file. PythonAnywhere is asking you where it should create a directory and put a single file with a really really simple website. The default should be fine; it will create a subdirectory of your home directory called `mysite` and then will put the Flask code into a file called `flask_app.py` inside that directory.
118
+
This page is asking you where you want to put your code. Code on PythonAnywhere is stored in your home directory, `/home/`*yourusername*, and in its subdirectories. Flask is a particularly lightweight framework, and you can write a simple Flask app in a single file. PythonAnywhere is asking you where it should create a directory and put a single file with a really really simple website. The default should be fine; it will create a subdirectory of your home directory called `mysite` and then will put the Flask code into a file called `flask_app.py` inside that directory.
101
119
102
120
*(It will overwrite any other file with the same name, so if you're _not_ using a new PythonAnywhere account, make sure that the file that it's got in the "Path" input box isn't one of your existing files.)*
103
121
@@ -166,7 +184,7 @@ function of its own. It's generally a good idea to keep the web app code -- th
166
184
display pages -- from the more complicated processing code (after all, if we were doing the stock analysis
167
185
example rather than this simple add-two-numbers script, the processing could be thousands of lines long).
168
186
169
-
So, we'll create a new file for our processing code. Go back to the browser tab that's showing your editor page; you'll see
187
+
So, we'll create a new file for our processing code. Go back to the browser tab that's showing your editor page; up at the top, you'll see
170
188
"breadcrumb" links showing you where the file is stored. They'll be a series of directory names separated
171
189
by "/" characters, each one apart from the last being a link.
172
190
The last one, just before the name of the file containing your Flask code,
@@ -299,7 +317,7 @@ numbers, and click the "Do calculation" button, and you'll get... an incomprehen
0 commit comments