Skip to content

Commit 02e5b59

Browse files
author
Resolver Developers
committed
Adds static directory and image files for django tutorial. By Giles &
Hansel.
1 parent 5241f27 commit 02e5b59

7 files changed

Lines changed: 22 additions & 5 deletions

File tree

content/django.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ The gruesome details for beginners
194194

195195
The main web tab at Python Anywhere looks like this:
196196

197-
.. image:: http://www.pythonanywhere.com/static/anywhere/images/tutorial/django/pa_web_dashboard.jpg
197+
.. image:: http://tutorial.pythonanywhere.com/static/django/pa_web_dashboard.jpg
198198

199199
To edit your wsgi.py file you click the link titled "this WSGI file". Every
200200
time you make a change to the files on the Python Anywhere servers you need to
@@ -218,7 +218,7 @@ Starting a new django project
218218
Django is already installed on Python Anywhere so you it is easy to get started.
219219

220220

221-
.. image:: http://www.pythonanywhere.com/static/anywhere/images/tutorial/django/pa_console_dashboard.jpg
221+
.. image:: http://tutorial.pythonanywhere.com/static/django/pa_console_dashboard.jpg
222222

223223
The first commands need to be run inside a bash console. You will need to go to
224224
the "Consoles" tab of Python Anywhere and click on the link highlighted in red
@@ -249,7 +249,7 @@ So, enter the code below into a bash console:
249249
Below is a an example of what your console should look like after you have done
250250
this.
251251

252-
.. image:: http://www.pythonanywhere.com/static/anywhere/images/tutorial/django/pa_console_django_start.jpg
252+
.. image:: http://tutorial.pythonanywhere.com/static/django/pa_console_django_start.jpg
253253

254254
Your next step is to edit the wsgi.py file which is located at /var/www/wsgi.py.
255255

server/renderer/templates/tutorial_base.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,26 @@
3535
</head>
3636

3737
<body style="margin:50px 0px; padding:0px; text-align:center; ">
38+
39+
40+
41+
42+
43+
44+
3845
<div style="width:900px; margin:0px auto; text-align:left; margin-bottom: 50px">
3946

47+
<a href="http://www.pythonanywhere.com"><img style="float: left;" id="id_logo" src="http://www.pythonanywhere.com/static/anywhere/images/logo-234x35.png" height="35" title="PythonAnywhere logo" alt="PythonAnywhere logo" /></a>
48+
49+
<br /><br /><br />
50+
4051
{% autoescape off %}
4152
<h1 id="id_tutorial_title">{{ title }}</h1>
4253

4354
{{ body }}
4455
{% endautoescape %}
4556
</div>
46-
57+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/2.5/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 Generic License</a>.
4758

4859
</body>
4960
</html>

server/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
5959
# Example: "/home/media/media.lawrence.com/static/"
6060
STATIC_ROOT = ''
61+
STATIC_DOC_ROOT = '/home/tutorial/pythonanywhere_tutorials/static'
6162

6263
# URL prefix for static files.
6364
# Example: "http://media.lawrence.com/static/"

server/urls.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
from django.conf.urls.defaults import patterns, include, url
22

33
from server.renderer.views import render_view
4-
4+
from server import settings
55

66
urlpatterns = patterns('',
7+
url(r'^static/(?P<path>.*)$', 'django.views.static.serve',
8+
{'document_root': settings.STATIC_DOC_ROOT, 'show_indexes': True}),
9+
710
url(r'^(.*)$', render_view, name='render_view')
811
)
12+
13+
57.2 KB
Loading
51.9 KB
Loading

static/django/pa_web_dashboard.jpg

78.9 KB
Loading

0 commit comments

Comments
 (0)