Django

Code

Changeset 2762

Show
Ignore:
Timestamp:
04/27/06 23:47:12 (2 years ago)
Author:
adrian
Message:

magic-removal: Proofread docs/faq.txt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/docs/faq.txt

    r2524 r2762  
    99---------------------------- 
    1010 
    11 Django grew from a very practical need: in our fast-paced newsroom, we often 
    12 have only a matter of hours to take a complicated Web application from 
    13 concept to public launch.  Django was designed to not only allow us to 
    14 build Web applications quickly, but to allow us to build them right. 
     11Django grew from a very practical need: World Online, a newspaper Web 
     12operation, is responsible for building intensive Web applications on journalism 
     13deadlines. In the fast-paced newsroom, World Online often has only a matter of 
     14hours to take a complicated Web application from concept to public launch. 
     15 
     16At the same time, the World Online Web developers have consistently been 
     17perfectionists when it comes to following best practices of Web development. 
     18 
     19Thus, Django was designed not only to allow fast Web development, but 
     20*best-practice* Web development. 
    1521 
    1622Django would not be possible without a whole host of open-source projects -- 
    17 `Apache`_, `Python`_, and `PostgreSQL`_ to name a few -- and we're thrilled to be 
    18 able to give something back to the open-source community. 
     23`Apache`_, `Python`_, and `PostgreSQL`_ to name a few -- and we're thrilled to 
     24be able to give something back to the open-source community. 
    1925 
    2026.. _Apache: http://httpd.apache.org/ 
     
    3036Listen to his music. You'll like it. 
    3137 
    32 According to Wikipedia_, "Django is pronounced **zhane**-go (with a long 'a')." 
     38Django is pronounced **JANG**-oh. Rhymes with FANG-oh. 
    3339 
    3440.. _Django Reinhardt: http://en.wikipedia.org/wiki/Django_Reinhardt 
    35 .. _Wikipedia: http://en.wikipedia.org/wiki/Django_Reinhardt 
    3641 
    3742Is Django stable? 
    3843----------------- 
    3944 
    40 We've been using Django for almost two years. Sites built on Django have 
    41 weathered traffic spikes of over one million hits an hour, and at leas
    42 one Slashdotting. Yes, it's quite stable. 
     45Yes. World Online has been using Django for more than two years. Sites built on 
     46Django have weathered traffic spikes of over one million hits an hour and a
     47least one Slashdotting. Yes, it's quite stable. 
    4348 
    4449Does Django scale? 
     
    4752Yes. Compared to development time, hardware is cheap, and so Django is 
    4853designed to take advantage of as much hardware as you can throw at it. 
    49 Django ships with clean separation of the database layer from the 
    50 application layer and a simple-yet-powerful `cache framework`_. 
     54 
     55Django uses a "shared-nothing" architecture, which means you can add hardware 
     56at any level -- database servers, caching servers or Web/application servers. 
     57 
     58The framework cleanly separates components such as its database layer and 
     59application layer. And it ships with a simple-yet-powerful `cache framework`_. 
    5160 
    5261.. _`cache framework`: http://www.djangoproject.com/documentation/cache/ 
     
    6170    Adrian is a Web developer with a background in journalism. He was lead 
    6271    developer at World Online for 2.5 years, during which time Django was 
    63     developed and implemented on World Online's sites. Now he's editor of 
    64     editorial innovations at washingtonpost.com, and he continues to oversee 
    65     Django development. He likes playing guitar (Django Reinhardt style) and 
    66     hacking on side projects such as `chicagocrime.org`_. He lives in Chicago. 
     72    developed and implemented on World Online's sites. Now he works for 
     73    washingtonpost.com building rich, database-backed information sites, and 
     74    continues to oversee Django development. He likes playing guitar (Django 
     75    Reinhardt style) and hacking on side projects such as `chicagocrime.org`_. 
     76    He lives in Chicago. 
    6777 
    6878    On IRC, Adrian goes by ``adrian_h``. 
     79 
     80`Jacob Kaplan-Moss`_ 
     81    Jacob is a whipper-snapper from California who spends equal time coding and 
     82    cooking. He's lead developer at World Online and actively hacks on various 
     83    cool side projects. He's contributed to the Python-ObjC bindings and was 
     84    the first guy to figure out how to write Tivo apps in Python. Lately he's 
     85    been messing with Python on the PSP. He lives in Lawrence, Kansas. 
     86 
     87    On IRC, Jacob goes by ``jacobkm``. 
    6988 
    7089`Simon Willison`_ 
    7190    Simon is a well-respected Web developer from England. He had a one-year 
    7291    internship at World Online, during which time he and Adrian developed 
    73     Django from scratch. He's enthusiastic, he's passionate about best 
    74     practices in Web development, and he really likes squirrels. Probably to a 
    75     fault. He went back to university to finish his degree and is poised to 
    76     continue doing big, exciting things on the Web. He lives in England. 
     92    Django from scratch. The most enthusiastic Brit you'll ever meet, he's 
     93    passionate about best practices in Web development and has maintained a 
     94    well-read Web-development blog for years at http://simon.incutio.com. 
     95    He works for Yahoo UK, where he managed to score the title "Hacker Liason." 
     96    He lives in London. 
    7797 
    7898    On IRC, Simon goes by ``SimonW``. 
    79  
    80 `Jacob Kaplan-Moss`_ 
    81     Jacob is a whipper-snapper from California who spends equal time coding and 
    82     cooking. He does Web development for World Online and actively hacks on 
    83     various cool side projects. He's contributed to the Python-ObjC bindings and 
    84     was the first guy to figure out how to write Tivo apps in Python. Lately 
    85     he's been messing with Python on the PSP. He lives in Lawrence, Kansas. 
    86  
    87     On IRC, Jacob goes by ``jacobkm``. 
    8899 
    89100`Wilson Miner`_ 
     
    107118----------------------- 
    108119 
    109 The Django wiki features a `list of Django-powered sites`_. Feel free to add 
    110 your Django-powered site to the list. 
     120The Django wiki features a consistently growing `list of Django-powered sites`_. 
     121Feel free to add your Django-powered site to the list. 
    111122 
    112123.. _list of Django-powered sites: http://code.djangoproject.com/wiki/DjangoPoweredSites 
     
    115126----------------------------------------------------------------------------------------------------------------------------------------------------- 
    116127 
    117 That's because Django isn't strictly a MVC framework. We don't really believe in 
    118 any capital-M Methodologies; we do what "feels" right. If you squint the right 
    119 way, you can call Django's ORM the "Model", the view functions the "View", and 
    120 the dynamically-generated API the "Controller" -- but not really. 
     128That's because Django isn't strictly a MVC framework. If you squint the right 
     129way, you can call Django's database layer the "Model", the view functions the 
     130"View", and the URL dispatcher the "Controller" -- but not really. 
    121131 
    122132In fact, you might say that Django is a "MTV" framework -- that is, Model, 
     
    184194That translates into summer 2006. 
    185195 
     196The merging of Django's `magic-removal branch`_ went a long way toward Django 
     1971.0. 
     198 
    186199Of course, you should note that `quite a few production sites`_ use Django in 
    187200its current status. Don't let the lack of a 1.0 turn you off. 
    188201 
     202.. _magic-removal branch: http://code.djangoproject.com/wiki/RemovingTheMagic 
    189203.. _quite a few production sites: http://code.djangoproject.com/wiki/DjangoPoweredSites 
    190204 
     
    226240--------------------------------------------------------------- 
    227241 
    228 Just run the ``ex_setup.py`` script in the Django distribution. 
     242Just run the ``ez_setup.py`` script in the Django distribution. 
    229243 
    230244What are Django's prerequisites? 
    231245-------------------------------- 
    232246 
    233 Django requires Python_ 2.3 or later. 
     247Django requires Python_ 2.3 or later. No other Python libraries are required. 
    234248 
    235249For a development environment -- if you just want to experiment with Django -- 
     
    257271 
    258272For production use, though, we recommend mod_python. The Django developers have 
    259 been running it on mod_python for about two years, and it's quite stable. 
     273been running it on mod_python for more than two years, and it's quite stable. 
    260274 
    261275However, if you don't want to use mod_python, you can use a different server, 
     
    325339There's nothing about Django that requires using the template language, so 
    326340if you're attached to ZPT, Cheetah, or whatever, feel free to use those. 
     341 
     342Do I have to use your model/database layer? 
     343------------------------------------------- 
     344 
     345Nope. Just like the template system, the model/database layer is decoupled from 
     346the rest of the framework. The one exception is: If you use a different 
     347database library, you won't get to use Django's automatically-generated admin 
     348site. That app is coupled to the Django database layer. 
    327349 
    328350How do I use image and file fields? 
     
    368390statements manually in your database. That's the way we've always done it, 
    369391because dealing with data is a very sensitive operation that we've wanted to 
    370 avoid automating. That said, there's some work being done to add a 
    371 ``django-admin.py updatedb`` command, which would output the necessary 
    372 ``ALTER TABLE`` statements, if any. 
     392avoid automating. That said, there's some work being done to add partially 
     393automated database-upgrade functionality. 
    373394 
    374395Do Django models support multiple-column primary keys? 
     
    393414this:: 
    394415 
    395     >>> from django.core.db import db 
    396     >>> db.queries 
     416    >>> from django.db import connection 
     417    >>> connection.queries 
    397418    [{'sql': 'SELECT polls_polls.id,polls_polls.question,polls_polls.pub_date FROM polls_polls', 
    398419    'time': '0.002'}] 
    399420 
    400 ``db.queries`` is only available if ``DEBUG`` is ``True``. It's a list of 
    401 dictionaries in order of query execution. Each dictionary has the following:: 
     421``connection.queries`` is only available if ``DEBUG`` is ``True``. It's a list 
     422of dictionaries in order of query execution. Each dictionary has the following:: 
    402423 
    403424    ``sql`` -- The raw SQL statement 
    404425    ``time`` -- How long the statement took to execute, in seconds. 
    405426 
    406 ``db.queries`` includes all SQL statements -- INSERTs, UPDATES, SELECTs, etc. 
    407 Each time your app hits the database, the query will be recorded. 
     427``connection.queries`` includes all SQL statements -- INSERTs, UPDATES, 
     428SELECTs, etc. Each time your app hits the database, the query will be recorded. 
    408429 
    409430Can I use Django with a pre-existing database? 
     
    466487---------------------------------------------------------------------------- 
    467488 
    468 Django won't bother displaying the filter for a ManyToManyField if there are 
    469 fewer than two related objects. 
     489Django won't bother displaying the filter for a ``ManyToManyField`` if there 
     490are fewer than two related objects. 
    470491 
    471492For example, if your ``list_filter`` includes ``sites``, and there's only one 
     
    478499You've got several options. If you want to piggyback on top of an add/change 
    479500form that Django automatically generates, you can attach arbitrary JavaScript 
    480 modules to the page via the model's ``admin.js`` parameter. That parameter is 
    481 a list of URLs, as strings, pointing to JavaScript modules that will be 
    482 included within the admin form via a <script> tag. 
     501modules to the page via the model's ``class Admin`` ``js`` parameter. That 
     502parameter is a list of URLs, as strings, pointing to JavaScript modules that 
     503will be included within the admin form via a ``<script>`` tag. 
    483504 
    484505If you want more flexibility than simply tweaking the auto-generated forms, 
     
    493514------------------------------------------------------------------ 
    494515 
    495 We think it's very purty, but if you don't agree, you can modify the admin 
    496 site's presentation by editing the CSS stylesheet and/or associated image files. 
    497 The site is built using semantic HTML, so any changes you'd like to make shoul
    498 be possible by editing the CSS stylesheet. We've got a `guide to the CSS used in 
    499 the admin`_ to get you started. 
     516We like it, but if you don't agree, you can modify the admin site's 
     517presentation by editing the CSS stylesheet and/or associated image files. The 
     518site is built using semantic HTML and plenty of CSS hooks, so any changes you'
     519like to make should be possible by editing the stylesheet. We've got a 
     520`guide to the CSS used in the admin`_ to get you started. 
    500521 
    501522.. _`guide to the CSS used in the admin`: http://www.djangoproject.com/documentation/admin_css/ 
     523 
     524How do I create users without having to edit password hashes? 
     525------------------------------------------------------------- 
     526 
     527We don't recommend you create users via the admin interface, because at the 
     528moment it requires you to edit password hashes manually. (Passwords are hashed 
     529using one-way hash algorithms for security; there's currently no Web interface 
     530for changing passwords by entering the actual password rather than the hash.) 
     531 
     532To create a user, you'll have to use the Python API. See `creating users`_ for 
     533full info. 
     534 
     535.. _creating users: http://www.djangoproject.com/documentation/authentication/#creating-users