]> scripts.mit.edu Git - www/raw.git/blob - faq/127.mdwn
Import from TextPattern
[www/raw.git] / faq / 127.mdwn
1 [[!meta title="How can I import an outside Django project?"]]
2 Configuring an outside Django project to run on scripts can be a
3 bit tricky if you’ve only before had experience with “./manage.py
4 runserver”. Here’s one way to get a Django project running on
5 scripts.mit.edu:
6
7 1.  Start with the [regular scripts Django autoinstaller](/start/)
8 2.  Move the created
9     /mit/lockername/Scripts/django/projname^[1](#fn7483266754e7f7937783a8)^
10     aside to /mit/lockername/Scripts/django/projname.auto
11 3.  Copy in *your* application’s code to
12     /mit/lockername/Scripts/django/projname
13 4.  Update the paths in
14     /mit/lockername/web\_scripts/progname/index.fcgi
15     1.  Make sure that the sys.path.insert line points to the directory
16         *containing* projname (likely /mit/lockername/Scripts/django/)
17     2.  Possibly add a sys.path.insert line that points to
18         /mit/lockername/Scripts/django/projname, if your includes are
19         appname.models, not projname.appname.models (or similar)
20     3.  Make sure the chdir line is right —- it should point to the
21         directory containing your project code
22
23 5.  Add a symbolic link from
24     /mit/lockername/web\_scripts/projname/media/ to
25     /mit/lockername/Scripts/django/projname/media/
26 6.  Merge the autoinstalled settings.py (that is,
27     /mit/lockername/Scripts/django/projname.auto/settings.py) into your
28     settings.py
29     1.  Copy the database information
30     2.  Copy the SECRET\_KEY, or make your own new one
31     3.  Copy the ADMIN\_MEDIA\_PREFIX —- for scripts.mit.edu, this
32         should be “/\_\_scripts/django/media/”
33     4.  Make sure the value of MEDIA\_URL is reasonable (generally
34         “/projname/media/”)
35
36 7.  Set up your database appropriately, either by running
37     “./manage.py syncdb” or by installing a database dump from a
38     running copy of your project
39 8.  Once you’ve confirmed that your Django project works, delete
40     /mit/lockername/Scripts/django/projname.auto/
41
42 ^1^ On Athena 9 or the Sun dialups, you may need to do “attach
43 lockername” first.
44
45
46