Changeset 187
- Timestamp:
- 07/18/05 18:14:48 (3 years ago)
- Files:
-
- django/trunk/docs/faq.txt (modified) (9 diffs)
- django/trunk/docs/install.txt (modified) (1 diff)
- django/trunk/docs/tutorial02.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/faq.txt
r133 r187 21 21 .. _Python: http://www.python.org/ 22 22 .. _PostgreSQL: http://www.postgresql.org/ 23 24 23 25 24 What does "Django" mean, and how do you pronounce it? … … 98 97 ----------------------------------------------------------------------------------------------------------------------------------------------------- 99 98 100 That's because Django isn't strictly a MVC framework. We don't really believe in101 any capital-M Methodologies; we do what "feels" right. If you squint the right99 That's because Django isn't strictly a MVC framework. We don't really believe in 100 any capital-M Methodologies; we do what "feels" right. If you squint the right 102 101 way, you can call Django's ORM the "Model", the view functions the "View", and 103 102 the dynamically-generated API the "Controller" -- but not really. … … 110 109 --------------------------------------------------- 111 110 112 They're in the works. It's amazing how much time those things take! Stay tuned...111 They're in the works. It's amazing how much time those things take! Stay tuned... 113 112 114 113 Installation questions … … 121 120 #. Install Django (read the `installation guide`_). 122 121 #. Walk through the tutorial_. 123 #. Check out the rest of the documentation_, and ask questionsif you122 #. Check out the rest of the documentation_, and `ask questions`_ if you 124 123 run into trouble. 125 124 … … 128 127 .. _tutorial: http://www.djangoproject.com/documentation/tutorial1/ 129 128 .. _documentation: http://www.djangoproject.com/documentation/ 129 .. _ask questions: http://www.djangoproject.com/community/ 130 130 131 131 How do I fix the "install a later version of setuptools" error? … … 137 137 -------------------------------- 138 138 139 Django requires Python_ 2.3 or later, `Apache 2`_, and mod_python_. 139 Django requires Python_ 2.3 or later. 140 141 For a development environment -- if you just want to experiment with Django -- 142 you don't need to have a separate Web server installed; Django comes with its 143 own lightweight development server. For a production environment, we recommend 144 `Apache 2`_ and mod_python_, although Django follows the WSGI_ spec, which 145 means it can run on a variety of server platforms. 140 146 141 147 You'll also need a database engine. PostgreSQL_ is recommended, and MySQL_ is … … 145 151 .. _Apache 2: http://httpd.apache.org/ 146 152 .. _mod_python: http://www.modpython.org/ 153 .. _WSGI: http://www.python.org/peps/pep-0333.html 147 154 .. _PostgreSQL: http://www.postgresql.org/ 148 155 .. _MySQL: http://www.mysql.com/ 149 156 157 Do I have to use mod_python? 158 ---------------------------- 159 160 Not if you just want to play around and develop things on your local computer. 161 Django comes with its own Web server, and things should Just Work. 162 163 For production use, though, we recommend mod_python. The Django developers have 164 been running it on mod_python for about two years, and it's quite stable. 165 166 However, if you don't want to use mod_python, you can use a different server, 167 as long as that server has WSGI_ hooks. More information on alternate server 168 arrangements is forthcoming. 169 170 .. _WSGI: http://www.python.org/peps/pep-0333.html 171 150 172 How do I install mod_python on Windows? 151 173 --------------------------------------- 152 174 153 * If you are running Python 2.4, check out this `guide to mod_python & Python 2.3`_. 154 155 * For Python 2.3, grab mod_python from http://www.mod_python.org/, the read 156 `Running mod_python on Apache on Windows2000`_. 157 158 * Also try this (not Windows-specific) `guide to getting mod_python working`_. 175 * For Python 2.4, check out this `guide to mod_python & Python 2.3`_. 176 * For Python 2.3, grab mod_python from http://www.mod_python.org/ and read 177 `Running mod_python on Apache on Windows2000`_. 178 * Also, try this (not Windows-specific) `guide to getting mod_python working`_. 159 179 160 180 .. _`guide to mod_python & Python 2.3`: http://www.lehuen.com/nicolas/index.php/2005/02/21/39-win32-build-of-mod_python-314-for-python-24 … … 164 184 (Thanks to deelan for this info.) 165 185 166 Do I have to use mod_python?167 ----------------------------168 169 In the first release, yes. However, WSGI_ support (which will let Django run170 under FCGI, SCGI, medusa, etc.) is in the works. Stay tuned!171 172 .. _WSGI: http://www.python.org/peps/pep-0333.html173 174 186 Will Django run under shared hosting (like TextDrive or Dreamhost)? 175 187 ------------------------------------------------------------------- 176 188 177 189 Right now, no, unless you can get your host to install mod_python. However, as 178 the previous answer says, WSGI support is coming! 190 the community starts to use Django's WSGI bindings with other Web servers, this 191 will probably be possible sooner rather than later. 179 192 180 193 Using Django … … 245 258 246 259 .. _`guide to the CSS used in the admin`: http://www.djangoproject.com/documentation/admin_css/ 247 django/trunk/docs/install.txt
r177 r187 8 8 ============================= 9 9 10 Currently, Django runs on Apache_ with `mod_python`_. mod_python is similar to 11 mod_perl -- it embeds Python within Apache and loads Python code into memory 12 when the server starts. Code stays in memory throughout the life of an Apache 13 process, which leads to significant performance gains over CGI. 10 If you just want to experiment with Django, skip this step. Django comes with 11 its own Web server for development purposes. 14 12 15 If you can't use mod_python for some reason, fear not: We're planning full WSGI_ 16 support, which means Django will run on a variety of server platforms. 13 If you want to use Django on a production site, use Apache with `mod_python`_. 14 mod_python is similar to mod_perl -- it embeds Python within Apache and loads 15 Python code into memory when the server starts. Code stays in memory throughout 16 the life of an Apache process, which leads to significant performance gains 17 over other server arrangements. Make sure you have Apache installed, with the 18 mod_python module activated. 17 19 18 For the time being, make sure you have Apache installed, with the mod_python 19 module activated. 20 If you can't use mod_python for some reason, fear not: Django follows the WSGI_ 21 spec, which allows it to run on a variety of server platforms. As people 22 experiment with different server platforms, we'll update this document to 23 give specific installation instructions for each platform. 20 24 21 25 .. _Apache: http://httpd.apache.org/ django/trunk/docs/tutorial02.txt
r183 r187 26 26 managers. 27 27 28 Expose the admin media files 28 Start the development server 29 29 ============================ 30 30 31 Django's admin is intended to be fully functional and good looking. For that 32 reason, Django ships with admin media files -- CSS, JavaScript and images -- 33 that comprise the admin's design. To set up a Django admin instance, the first 34 thing to do is put those media files online somewhere. 35 36 (Note: Although Django ships with a default design for its admin site, you can 37 change it however you'd like. The admin uses Django's own template system and 38 is powered -- surprise, surprise -- by Django itself, so it is completely 39 customizable.) 40 41 The files are in the ``media`` directory of the Django distribution. To 42 "activate" them, copy that directory under a Web document root somewhere, so 43 that you can access them via the Web. 44 45 Be careful not to put your Python source code under the Web document root. Just 46 do the media files. 47 48 Then, tell Django where you put them, via ``ADMIN_MEDIA_PREFIX`` in the 49 ``myproject.settings.admin`` settings file. Examples:: 50 51 # You can leave off the domain if they're on the same domain as your admin 52 # site will be. 53 ADMIN_MEDIA_PREFIX = '/adminmedia/' 54 55 # Otherwise, use the fully-qualified domain. 56 ADMIN_MEDIA_PREFIX = 'http://www.foo.com/adminmedia/' 57 58 Make sure to include a trailing slash. 59 60 Hook into mod_python 61 ==================== 62 63 Now let's take the opportunity to hook Django into Apache/mod_python. Edit your 64 ``httpd.conf`` file and add this:: 65 66 <Location "/admin/"> 67 SetHandler python-program 68 PythonHandler django.core.handlers.modpython 69 SetEnv DJANGO_SETTINGS_MODULE myproject.settings.admin 70 PythonDebug On 71 </Location> 72 73 This tells Apache: "Use mod_python for any URL at or under '/admin/', using the 74 Django mod_python handler." It also passes the value of ``DJANGO_SETTINGS_MODULE``, 75 so mod_python knows which project to use. Note that we're passing the path to 76 the ``admin`` settings, not the ``main`` settings. That's because this is the 77 admin site, which has slightly different settings. 78 79 Also, if you've manually altered your ``PYTHONPATH`` to put your project on it, 80 you'll need to tell mod_python:: 81 82 PythonPath "['/path/to/project'] + sys.path" 83 84 You can also add directives such as ``PythonAutoReload Off`` for performance. 85 See the `mod_python documentation`_ for a full list of options. 86 87 When you've done that, restart Apache and go to /admin/ on your domain. You 88 should see the admin's login screen: 31 To make things easy, Django comes with a pure-Python Web server that builds on 32 the BaseHTTPServer included in Python's standard library. Let's start the 33 server and explore the admin site. First, set the ``DJANGO_SETTINGS_MODULE`` 34 environment variable to the location of your admin settings:: 35 36 export DJANGO_SETTINGS_MODULE=myproject.settings.admin 37 38 Then, run this command to start the server:: 39 40 django-admin.py runserver 41 42 It'll start a Web server running locally -- on port 8000, by default. If you 43 want to change the server's port, pass it as a command-line argument:: 44 45 django-admin.py runserver 8080 46 47 Now, open a Web browser and go to "/admin/" on your domain. You should see the 48 admin's login screen: 89 49 90 50 .. image:: http://media.djangoproject.com/img/doc/tutorial/admin01.png 91 51 :alt: Django admin login screen 92 52 93 .. _mod_python documentation: http://modpython.org/live/current/doc-html/directives.html94 95 53 Create a user account 96 54 ===================== 97 55 98 We can't log in, though, because we haven't created an admin user account yet. 99 Drop into the Python interactive interpreter and type this::56 You can't log in, though, because you haven't created an admin user account 57 yet. Drop into the Python interactive interpreter and type this:: 100 58 101 59 # The function django.models.auth.users.create_user() creates a new user … … 152 110 ) 153 111 154 Reload the Django admin index page. Note that you might have to restart Apache, 155 depending on your Apache settings. Because mod_python saves code in memory for 156 performance, Python code changes generally aren't reflected until Apache 157 restarts. One way around this is to set ``MaxRequestsPerChild 1`` in your 158 httpd.conf to force Apache to reload everything for each request. But don't do 159 that on a production server, or we'll revoke your Django privileges. 112 Restart your development Web server, and reload the Django admin page. You'll 113 have to restart the server each time you make a change to Python code -- but 114 we're working on changing that. 160 115 161 116 Explore the free admin functionality
