Anonymous avatar Anonymous committed 2f40797

add staticfiles work

Comments (0)

Files changed (12)

+To run these tests I would like to use something automatic like nose and twill or something
+but for now it's by hand
+I set up a virtualenv with django 1.3 pre installed on it, and then cd to testdjangoproject
+To run basic tests::
+  python runwsgiserver
+And visit http://locahost:8000/ in a browser
+To run ssl tests::
+  ./test_ssl
+and vist https://localhost:8443/ in a browser
+currently test_statics adds to the settings file to put in STATICFILES_ROOT
+The web page shows links to click on.




+# serve static files via wsgiserver and mediahandler
+# test serving a single directory
+# test performance
+# test serving multiple directories with dispatch
+# test urls that try to escape root
+# sketch test out a potential upload or an actual upload to pypi
+# requires: virtualenv, pip
+# create a virtualenv testenv
+# activate the enviroment
+# install $pkg:
+# pip install -e $pkgrepo
+# pip install $pkg
+# pip install -e $testprojdir
+# cd tesprojdir; python tests
+# also do visual tests


+This text file is in the notstatic3 directory


+from settings import *
+STATICFILES_ROOT = os.path.join(PROJECT_ROOT, 'static')
+# experimental for development work it would be nice to not need to
+# run collectstatic all the time
+  # 
+  # ("urlprefix", "/path/to/the/files"), # I usually have urlprefix be appname
+    os.path.join(PROJECT_ROOT, "static2"),
+    ('static3', os.path.join(PROJECT_ROOT, "notstatic3")),


+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "">
+    <title>test static html file in static root</title>
+<h3>test static html file in static root</h3>


+A test text file


+This textfile is in the static2 directory


+  <head>
+    <title>django-wsgiserver</title>
+  </head>
+  <body><h2>hello django-wsgiserver</h2>
+    <h3>Tests</h3>
+    <ul>
+      <li> <a href="/admin/">Check the default admin css media service</a></li>
+      <li> <a href="/static/textfile.txt">/static/textfile.txt </a></li>
+      <li> <a href="/static/htmlfile.html">/static/htmlfile.txt </a></li>
+      <li> <a href="/static/../"> /static/../ security test</a> should not return the file! (either forbidden or remap to another url)</li>
+      {% else %}
+      <li> Staticfiles are not being used </li>
+{% endif %}
+    </ul>


+python ./ runwsgiserver --settings=settings_statics
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.