Skip to content

Commit e5948c2

Browse files
author
tutorial
committed
Python Anywhere css now used tutorial pages. Django tutorial started. By
Hansel
1 parent fccf949 commit e5948c2

2 files changed

Lines changed: 102 additions & 4 deletions

File tree

content/django.txt

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Creating a new django project on Python Anywhere
2+
=================================================================================
3+
The five minute guide
4+
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
5+
6+
7+
So you want to create a web application but you don't really want to do all the
8+
faffing around that is involved in setting up and configuring web servers?
9+
10+
Well that is one of the reasons we created Python Anywhere. This tutorial will
11+
take you through the process of creating a working django site with an admin
12+
interface and a front page that tells you the time.
13+
14+
To follow along with this tutorial you will need a `Python Anywhere <http://www.pythonanywhere.com/>`_
15+
account. Go and sign up if you don't already have one then come back here.
16+
17+
.. contents::
18+
19+
20+
21+
.. image:: http://www.pythonanywhere.com/static/anywhere/images/favicon.ico
22+
23+
24+
25+
The really quick start guide
26+
---------------------------------------------------------------------------------
27+
28+
To start with, for those people who are already very confident with django we will
29+
just start with a list of the steps and commands you need to run in order to get
30+
a working django app on Python Anywhere. Don't worry if you don't understand these
31+
now. We will go through each one step by step further down.
32+
33+
34+
header 2
35+
+++++++++++++++++++++++++
36+
37+
header 3
38+
________________________
39+
40+
41+
Starting a new django project
42+
---------------------------------------------------------------------------------
43+
44+
45+
46+
Editing your wsgi.py file
47+
---------------------------------------------------------------------------------
48+
49+
50+
51+
Configuring the database and enabling the admin interface
52+
---------------------------------------------------------------------------------
53+
54+
55+
56+
Defining your urls
57+
---------------------------------------------------------------------------------
58+
59+
60+
61+
62+
63+
Creating a template
64+
---------------------------------------------------------------------------------
65+
66+
67+
68+
69+
70+
Writing the first view
71+
---------------------------------------------------------------------------------
72+
73+
74+
75+
76+
77+
Python Anywhere specific tips
78+
---------------------------------------------------------------------------------
79+
80+
81+
82+
83+
84+
85+
86+
::
87+
88+
import os
89+
import sys
90+
## assuming your django settings file is at '/home/myname/mysite/settings.py'
91+
path = '/home/%s/'
92+
if path not in sys.path:
93+
sys.path.append(path)
94+
os.environ['DJANGO_SETTINGS_MODULE'] = 'my_test_project.settings'
95+
import django.core.handlers.wsgi
96+
application = django.core.handlers.wsgi.WSGIHandler()
97+
98+
Once your wsgi.py file looks like this we can move on.

server/renderer/templates/tutorial_base.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
22
<html>
33
<head>
44

5-
<link rel="stylesheet" href="/static/anywhere/styles/common_base.css" type="text/css" media="screen" charset="utf-8" />
6-
<link rel="stylesheet" href="/static/anywhere/styles/tutorial.css" type="text/css" media="screen" charset="utf-8" />
7-
<link rel="stylesheet" href="/static/pygments/style.css" type="text/css" media="screen" charset="utf-8" />
5+
<link rel="stylesheet" href="http://www.pythonanywhere.com/static/anywhere/styles/common_base.css" type="text/css" media="screen" charset="utf-8" />
6+
<link rel="stylesheet" href="http://www.pythonanywhere.com/static/anywhere/styles/tutorial.css" type="text/css" media="screen" charset="utf-8" />
7+
<link rel="stylesheet" href="http://www.pythonanywhere.com/static/pygments/style.css" type="text/css" media="screen" charset="utf-8" />
88

99
<script type="text/javascript">
1010
parent.setHash({{ pagenum }});

0 commit comments

Comments
 (0)