Commits

Carl Meyer committed dcff929 Draft

Update test project.

  • Participants
  • Parent commits 9ed2496

Comments (0)

Files changed (5)

File test_project/README.txt

 A bare-bones Django project for live-testing django-adminfiles; particularly
 Javascript functionality that can't easily be unit-tested.
 
-If I get really ambitious one day I might stick some Selenium scripts in
-here.
+Run ``pip install -r requirements.txt`` to install all the dependencies you
+need into a virtualenv; then run ``./run_test_project.sh`` to set up a test
+database and run the test server on ``http://localhost:8000``.
+
+Use admin/admin to log into the admin of the test server.
+
+Ideally we'd have Selenium tests for this stuff.

File test_project/manage.py

 #!/usr/bin/env python
-import sys, os
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-
-from django.core.management import execute_manager
-try:
-    import settings # Assumed to be in the same directory.
-except ImportError:
-    import sys
-    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
-    sys.exit(1)
+import os
+import sys
 
 if __name__ == "__main__":
-    execute_manager(settings)
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
+
+    from django.core.management import execute_from_command_line
+
+    execute_from_command_line(sys.argv)

File test_project/requirements.txt

+-e ..
+
+Django==1.5.1
+PIL==1.1.7
+djangoembed==0.1.1
+BeautifulSoup==3.2.1
+httplib2==0.8
+simplejson==3.3.0
+sorl-thumbnail==11.12
+wsgiref==0.1.2

File test_project/run_test_project.sh

 #!/bin/bash
 
 ./manage.py syncdb --noinput
-pushd media
-ln -s ../../adminfiles/media/adminfiles .
+pushd static
+ln -s ../../adminfiles/static/adminfiles .
 popd
 ./manage.py runserver
 rm adminfiles-test.db
-rm media/adminfiles
+rm static/adminfiles
+rm -rf media/*

File test_project/urls.py

-from django.conf.urls.defaults import *
+from django.conf.urls import patterns, url, include
 from django.conf import settings
-
-from django.contrib.staticfiles.urls import staticfiles_urlpatterns
 from django.conf.urls.static import static
 
 from django.contrib import admin
 admin.autodiscover()
 
 urlpatterns = patterns('',
-    (r'', include(admin.site.urls)),
-    (r'^adminfiles/', include('adminfiles.urls')),
-)
-
-if settings.DEBUG:
-    urlpatterns += staticfiles_urlpatterns()
-    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+    url(r'', include(admin.site.urls)),
+    url(r'^adminfiles/', include('adminfiles.urls')),
+) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)