Django

Code

Changeset 956

Show
Ignore:
Timestamp:
10/19/05 10:47:26 (3 years ago)
Author:
hugo
Message:

i18n: merged up to [954] from trunk. contains the big load of admin reworking stuff from adrian.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/i18n/django/contrib/admin/views/main.py

    r932 r956  
    77from django.core.extensions import DjangoContext as Context 
    88from django.core.extensions import get_object_or_404, render_to_response 
    9 from django.models.auth import log 
     9from django.models.admin import log 
    1010from django.utils.html import strip_tags 
    1111from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect 
     
    5050 
    5151def index(request): 
    52     return render_to_response('index', {'title': 'Site administration'}, context_instance=Context(request)) 
     52    return render_to_response('admin/index', {'title': 'Site administration'}, context_instance=Context(request)) 
    5353index = staff_member_required(index) 
    5454 
     
    267267                pass # Invalid argument to "list_filter" 
    268268 
    269     raw_template = ['{% extends "base_site" %}\n'] 
     269    raw_template = ['{% extends "admin/base_site" %}\n'] 
    270270    raw_template.append('{% block bodyclass %}change-list{% endblock %}\n') 
    271271    if not is_popup: 
     
    539539    ordered_objects = opts.get_ordered_objects()[:] 
    540540    auto_populated_fields = [f for f in opts.fields if f.prepopulate_from] 
    541     t = ['{% extends "base_site" %}\n'] 
     541    t = ['{% extends "admin/base_site" %}\n'] 
    542542    t.append('{% block extrahead %}') 
    543543 
     
    10881088        request.user.add_message('The %s "%s" was deleted successfully.' % (opts.verbose_name, obj_repr)) 
    10891089        return HttpResponseRedirect("../../") 
    1090     return render_to_response('delete_confirmation_generic', { 
     1090    return render_to_response('admin/delete_confirmation', { 
    10911091        "title": "Are you sure?", 
    10921092        "object_name": opts.verbose_name, 
     
    11031103    # If no history was found, see whether this object even exists. 
    11041104    obj = get_object_or_404(mod, pk=object_id) 
    1105     return render_to_response('admin_object_history', { 
     1105    return render_to_response('admin/object_history', { 
    11061106        'title': 'Change history: %r' % obj, 
    11071107        'action_list': action_list, 
  • django/branches/i18n/django/contrib/admin/views/template.py

    r932 r956  
    2424        if not errors: 
    2525            request.user.add_message('The template is valid.') 
    26     return render_to_response('template_validator', { 
     26    return render_to_response('admin/template_validator', { 
    2727        'title': 'Template validator', 
    2828        'form': formfields.FormWrapper(manipulator, new_data, errors), 
  • django/branches/i18n/django/core/db/backends/ado_mssql.py

    r886 r956  
    103103 
    104104def get_random_function_sql(): 
    105     # TODO: This is a guess. Make sure this is correct. 
    106     return "RANDOM()" 
     105    return "RAND()" 
     106 
     107def get_table_list(cursor): 
     108    raise NotImplementedError 
    107109 
    108110def get_relations(cursor, table_name): 
     
    152154    'USStateField':      'varchar(2)', 
    153155} 
     156 
     157DATA_TYPES_REVERSE = {} 
  • django/branches/i18n/django/core/handlers/base.py

    r886 r956  
    7575                    if response: 
    7676                        return response 
    77                 raise e 
     77                raise 
    7878 
    7979            # Complain if the view returned None (a common error). 
  • django/branches/i18n/django/core/management.py

    r844 r956  
    1818# which has been installed. 
    1919PROJECT_TEMPLATE_DIR = os.path.join(django.__path__[0], 'conf', '%s_template') 
    20 ADMIN_TEMPLATE_DIR = os.path.join(django.__path__[0], 'conf', 'admin_templates') 
    2120 
    2221def _get_packages_insert(app_label): 
     
    143142        cursor.execute("SELECT id FROM content_types WHERE package = %s", [app_label]) 
    144143        for row in cursor.fetchall(): 
    145             output.append("DELETE FROM auth_admin_log WHERE content_type_id = %s;" % row[0]) 
     144            output.append("DELETE FROM django_admin_log WHERE content_type_id = %s;" % row[0]) 
    146145 
    147146    # Close database connection explicitly, in case this output is being piped 
     
    379378    from random import choice 
    380379    _start_helper('project', project_name, directory) 
    381     # Populate TEMPLATE_DIRS for the admin templates, based on where Django is 
    382     # installed. 
    383     admin_settings_file = os.path.join(directory, project_name, 'settings', 'admin.py') 
    384     settings_contents = open(admin_settings_file, 'r').read() 
    385     fp = open(admin_settings_file, 'w') 
    386     settings_contents = re.sub(r'(?s)\b(TEMPLATE_DIRS\s*=\s*\()(.*?)\)', "\\1\n    r%r,\\2)" % ADMIN_TEMPLATE_DIR, settings_contents) 
    387     fp.write(settings_contents) 
    388     fp.close() 
    389380    # Create a random SECRET_KEY hash, and put it in the main settings. 
    390     main_settings_file = os.path.join(directory, project_name, 'settings', 'main.py') 
     381    main_settings_file = os.path.join(directory, project_name, 'settings.py') 
    391382    settings_contents = open(main_settings_file, 'r').read() 
    392383    fp = open(main_settings_file, 'w') 
  • django/branches/i18n/django/core/servers/basehttp.py

    r575 r956  
    603603        import django 
    604604        self.application = application 
    605         self.media_dir = django.__path__[0] + '/conf/admin_media' 
     605        self.media_dir = django.__path__[0] + '/contrib/admin/media' 
    606606        self.media_url = settings.ADMIN_MEDIA_PREFIX 
    607607 
  • django/branches/i18n/django/middleware/cache.py

    r844 r956  
    5353    def process_response(self, request, response): 
    5454        "Sets the cache, if needed." 
    55         if not request._cache_update_cache: 
     55        if not hasattr(request, '_cache_update_cache') or not request._cache_update_cache: 
    5656            # We don't need to update the cache, just return. 
    5757            return response 
  • django/branches/i18n/django/models/auth.py

    r912 r956  
    184184    def __repr__(self): 
    185185        return self.message 
    186  
    187     class META: 
    188         verbose_name = _('Message') 
    189         verbose_name_plural = _('Messages') 
    190  
    191 class LogEntry(meta.Model): 
    192     action_time = meta.DateTimeField(_('action time'), auto_now=True) 
    193     user = meta.ForeignKey(User) 
    194     content_type = meta.ForeignKey(core.ContentType, blank=True, null=True) # TODO: content_type_id name? 
    195     object_id = meta.TextField(_('object id'), blank=True, null=True) 
    196     object_repr = meta.CharField(_('object repr'), maxlength=200) 
    197     action_flag = meta.PositiveSmallIntegerField(_('action flag')) 
    198     change_message = meta.TextField(blank=True) 
    199     class META: 
    200         module_name = 'log' 
    201         verbose_name = _('log entry') 
    202         verbose_name_plural = _('log entries') 
    203         db_table = 'auth_admin_log' 
    204         ordering = ('-action_time',) 
    205         module_constants = { 
    206             'ADDITION': 1, 
    207             'CHANGE': 2, 
    208             'DELETION': 3, 
    209         } 
    210  
    211     def __repr__(self): 
    212         return str(self.action_time) 
    213  
    214     def is_addition(self): 
    215         return self.action_flag == ADDITION 
    216  
    217     def is_change(self): 
    218         return self.action_flag == CHANGE 
    219  
    220     def is_deletion(self): 
    221         return self.action_flag == DELETION 
    222  
    223     def get_edited_object(self): 
    224         "Returns the edited object represented by this log entry" 
    225         return self.get_content_type().get_object_for_this_type(pk=self.object_id) 
    226  
    227     def get_admin_url(self): 
    228         """ 
    229         Returns the admin URL to edit the object represented by this log entry. 
    230         This is relative to the Django admin index page. 
    231         """ 
    232         return "%s/%s/%s/" % (self.get_content_type().package, self.get_content_type().python_module_name, self.object_id) 
    233  
    234     def _module_log_action(user_id, content_type_id, object_id, object_repr, action_flag, change_message=''): 
    235         e = LogEntry(None, None, user_id, content_type_id, object_id, object_repr[:200], action_flag, change_message) 
    236         e.save() 
  • django/branches/i18n/docs/django-admin.txt

    r910 r956  
    193193Example usage:: 
    194194 
    195     django-admin.py init --settings='myproject.settings.main' 
     195    django-admin.py init --settings=myproject.settings 
    196196 
    197197Explicitly specifies the settings module to use. The settings module should be 
    198 in Python path syntax, e.g. "myproject.settings.main". If this isn't provided, 
     198in Python path syntax, e.g. "myproject.settings". If this isn't provided, 
    199199``django-admin.py`` will use the DJANGO_SETTINGS_MODULE environment variable. 
    200200 
  • django/branches/i18n/docs/faq.txt

    r653 r956  
    349349      to match your domain. For example, if you're going to 
    350350      "http://www.mysite.com/admin/" in your browser, in 
    351       "myproject.settings.admin" you should set ``SESSION_COOKIE_DOMAIN = 
    352       'www.mysite.com'``. 
     351      "myproject.settings" you should set ``SESSION_COOKIE_DOMAIN = 'www.mysite.com'``. 
    353352 
    354353    * Some browsers (Firefox?) don't like to accept cookies from domains that 
  • django/branches/i18n/docs/middleware.txt

    r886 r956  
    2828    ) 
    2929 
    30 The default admin site has the following ``MIDDLEWARE_CLASSES`` set:: 
    31  
    32     MIDDLEWARE_CLASSES = ( 
    33         "django.middleware.sessions.SessionMiddleware", 
    34         "django.middleware.admin.AdminUserRequired", 
    35         "django.middleware.common.CommonMiddleware", 
    36     ) 
    37  
    3830Django applies middleware in the order it's defined in ``MIDDLEWARE_CLASSES``. 
    3931 
    40 For a regular (i.e., non-admin) Django installation, no middleware is required, 
    41 but it's strongly suggested that you use ``CommonMiddleware``. For a Django 
    42 admin site, ``SessionMiddleware`` and ``AdminUserRequired`` (in that order) are 
    43 required. 
     32A Django installation doesn't require any middleware -- e.g., 
     33``MIDDLEWARE_CLASSES`` can be empty, if you'd like -- but it's strongly 
     34suggested that you use ``CommonMiddleware``. 
    4435 
    4536Available middleware 
    4637==================== 
    47  
    48 django.middleware.admin.AdminUserRequired 
    49 ----------------------------------------- 
    50  
    51 Limits site access to valid users with the ``is_staff`` flag set. This is 
    52 required by Django's admin, and this middleware requires ``SessionMiddleware``. 
    5338 
    5439django.middleware.cache.CacheMiddleware 
  • django/branches/i18n/docs/model-api.txt

    r898 r956  
    250250    The admin represents this as an ``<input type="file">`` (a file-upload widget). 
    251251 
    252     Using a `FieldField` or an ``ImageField`` (see below) in a model takes a few 
     252    Using a ``FileField` or an ``ImageField`` (see below) in a model takes a few 
    253253    steps: 
    254254 
  • django/branches/i18n/docs/modpython.txt

    r853 r956  
    2626        SetHandler python-program 
    2727        PythonHandler django.core.handlers.modpython 
    28         SetEnv DJANGO_SETTINGS_MODULE myproject.settings.main 
     28        SetEnv DJANGO_SETTINGS_MODULE myproject.settings 
    2929        PythonDebug On 
    3030    </Location> 
    3131 
    32 ...and replace ``myproject.settings.main`` with the Python path to your 
    33 settings file. 
     32...and replace ``myproject.settings`` with the Python path to your settings file. 
    3433 
    3534This tells Apache: "Use mod_python for any URL at or under '/mysite/', using the 
     
    5655time you make changes to your Python code. 
    5756 
    58 Here's a template for an admin configuration:: 
    59  
    60     <Location "/admin/"> 
    61         SetHandler python-program 
    62         PythonHandler django.core.handlers.modpython 
    63         SetEnv DJANGO_SETTINGS_MODULE myproject.settings.admin 
    64         PythonDebug On 
    65     </Location> 
    66  
    67 The only thing different here is the ``DJANGO_SETTINGS_MODULE``. 
    68  
    6957Multiple Django installations on the same Apache 
    7058================================================ 
     
    7866        ServerName www.example.com 
    7967        # ... 
    80         SetEnv DJANGO_SETTINGS_MODULE myproject.settings.main 
     68        SetEnv DJANGO_SETTINGS_MODULE myproject.settings 
    8169    </VirtualHost> 
    8270 
    8371    <VirtualHost *> 
    84         ServerName admin.example.com 
     72        ServerName www2.example.com 
    8573        # ... 
    86         SetEnv DJANGO_SETTINGS_MODULE myproject.settings.admin 
     74        SetEnv DJANGO_SETTINGS_MODULE myproject.other_settings 
    8775    </VirtualHost> 
    8876 
     
    9684        # ... 
    9785        <Location "/something"> 
    98             SetEnv DJANGO_SETTINGS_MODULE myproject.settings.main 
    99             PythonInterpreter myproject_main 
     86            SetEnv DJANGO_SETTINGS_MODULE myproject.settings 
     87            PythonInterpreter myproject 
    10088        </Location> 
    10189 
    102         <Location "/admin"> 
    103             SetEnv DJANGO_SETTINGS_MODULE myproject.settings.admin 
    104             PythonInterpreter myproject_admin 
     90        <Location "/otherthing"> 
     91            SetEnv DJANGO_SETTINGS_MODULE myproject.other_settings 
     92            PythonInterpreter myproject_other 
    10593        </Location> 
    10694    </VirtualHost> 
  • django/branches/i18n/docs/settings.txt

    r910 r956  
    3535 
    3636The value of ``DJANGO_SETTINGS_MODULE`` should be in Python path syntax, e.g. 
    37 ``"myproject.settings.main"``. Note that the settings module should be on the 
     37``"myproject.settings"``. Note that the settings module should be on the 
    3838Python `import search path`_. 
    3939 
     
    4848Example (Unix Bash shell):: 
    4949 
    50     export DJANGO_SETTINGS_MODULE=myproject.settings.main 
     50    export DJANGO_SETTINGS_MODULE=myproject.settings 
    5151    django-admin.py runserver 
    5252 
    5353Example (Windows shell):: 
    5454 
    55     set DJANGO_SETTINGS_MODULE=myproject.settings.main 
     55    set DJANGO_SETTINGS_MODULE=myproject.settings 
    5656    django-admin.py runserver 
    5757 
    5858Use the ``--settings`` command-line argument to specify the settings manually:: 
    5959 
    60     django-admin.py runserver --settings=myproject.settings.main 
     60    django-admin.py runserver --settings=myproject.settings 
    6161 
    6262.. _django-admin.py: http://www.djangoproject.com/documentation/django_admin/ 
     
    7171        SetHandler python-program 
    7272        PythonHandler django.core.handlers.modpython 
    73         SetEnv DJANGO_SETTINGS_MODULE myproject.settings.main 
     73        SetEnv DJANGO_SETTINGS_MODULE myproject.settings 
    7474    </Location> 
    7575 
  • django/branches/i18n/docs/tutorial01.txt

    r775 r956  
    4141        apps/ 
    4242            __init__.py 
    43         settings/ 
    44             __init__.py 
    45             admin.py 
    46             main.py 
    47             urls/ 
    48                 __init__.py 
    49                 admin.py 
    50                 main.py 
    51  
    52 First, edit ``myproject/settings/main.py``. It's a normal Python module with 
     43        settings.py 
     44        urls.py 
     45 
     46First, edit ``myproject/settings.py``. It's a normal Python module with 
    5347module-level variables representing Django settings. Edit the file and change 
    5448these settings to match your database's connection parameters: 
     
    7064    database's interactive prompt. 
    7165 
    72     Also, note that MySQL and sqlite support is a recent development, and Django 
    73     hasn't been comprehensively tested with either database. If you find any 
    74     bugs in those bindings, please file them in `Django's ticket system`_ so we 
    75     can fix them immediately. 
    76  
    7766Now, take a second to make sure ``myproject`` is on your Python path. You 
    7867can do this by copying ``myproject`` to Python's ``site-packages`` directory, 
     
    8574Run the following command:: 
    8675 
    87     django-admin.py init --settings=myproject.settings.main 
     76    django-admin.py init --settings=myproject.settings 
    8877 
    8978The ``django-admin.py`` utility generally needs to know which settings module 
     
    9382how you do that in the Bash shell on Unix:: 
    9483 
    95     export DJANGO_SETTINGS_MODULE=myproject.settings.main 
     84    export DJANGO_SETTINGS_MODULE=myproject.settings 
    9685 
    9786On Windows, you'd use ``set`` instead:: 
    9887 
    99     set DJANGO_SETTINGS_MODULE=myproject.settings.main 
     88    set DJANGO_SETTINGS_MODULE=myproject.settings 
    10089 
    10190If you don't see any errors after running ``django-admin.py init``, you know it 
     
    222211   a given Django installation. 
    223212 
    224 Edit the myproject/settings/main.py file again, and change the ``INSTALLED_APPS`` 
     213Edit the myproject/settings.py file again, and change the ``INSTALLED_APPS`` 
    225214setting to include the string "myproject.apps.polls". So it'll look like this:: 
    226215 
  • django/branches/i18n/docs/tutorial02.txt

    r596 r956  
    2525    managers. 
    2626 
     27Activate the admin site 
     28======================= 
     29 
     30The Django admin site is not activated by default -- it's an opt-in thing. To 
     31activate the admin site for your installation, do these three things: 
     32 
     33    * Add ``"django.contrib.admin"`` to your ``INSTALLED_APPS`` setting. 
     34    * Run the command ``django-admin.py install admin``. This will create an 
     35      extra database table that the admin needs. 
     36    * Edit your ``myproject.urls`` file and uncomment the line below 
     37      "Uncomment this for admin:". This file is a URLconf; we'll dig into 
     38      URLconfs in the next tutorial. For now, all you need to know is that it 
     39      maps URL roots to applications. 
     40 
    2741Create a user account 
    2842===================== 
     
    3044Run the following command to create a superuser account for your admin site:: 
    3145 
    32     django-admin.py createsuperuser --settings="myproject.settings.main" 
    33  
    34 (Note: You can use either "myproject.settings.main" or "myproject.settings.admin" 
    35 here. They both reference the same database.) 
     46    django-admin.py createsuperuser --settings=myproject.settings 
    3647 
    3748The script will prompt you for a username, e-mail address and password (twice). 
     
    4657Just run the following command to start the server:: 
    4758 
    48     django-admin.py runserver --settings="myproject.settings.admin" 
     59    django-admin.py runserver --settings=myproject.settings 
    4960 
    5061It'll start a Web server running locally -- on port 8000, by default. If you 
    5162want to change the server's port, pass it as a command-line argument:: 
    5263 
    53     django-admin.py runserver 8080 --settings="myproject.settings.admin" 
     64    django-admin.py runserver 8080 --settings=myproject.settings 
    5465 
    5566DON'T use this server in anything resembling a production environment. It's 
    5667intended only for use while developing. 
    5768 
    58 Now, open a Web browser and go to "/admin/" on your domain. You should see the 
    59 admin's login screen: 
     69Now, open a Web browser and go to "/admin/" on your local domain -- e.g., 
     70http://127.0.0.1:8000/admin/. You should see the admin's login screen: 
    6071 
    6172.. image:: http://media.djangoproject.com/img/doc/tutorial/admin01.png 
    6273   :alt: Django admin login screen 
    6374 
    64 .. admonition:: Note 
    65  
    66     If you get an error telling you that the URL 'admin/' didn't match any of 
    67     your URLconf entries, you most likely used ``myproject.settings.main`` 
    68     instead of ``myproject.settings.admin``. 
    69  
    7075Enter the admin site 
    7176==================== 
    7277 
    73 Now, try logging in. 
    74  
    75 If it didn't work, read the `"I can't log in" questions`_ in the FAQ. 
    76  
    77 If it worked, you should see the Django admin index page: 
     78Now, try logging in. You should see the Django admin index page: 
    7879 
    7980.. image:: http://media.djangoproject.com/img/doc/tutorial/admin02t.png 
     
    382383================================= 
    383384 
    384 Clearly having "Django administration" and "example.com" at the top of each 
     385Clearly, having "Django administration" and "example.com" at the top of each 
    385386admin page is ridiculous. It's just placeholder text. 
    386387 
    387 That's easy to change, though, using Django's template system. 
    388  
    389 Open your admin settings file and look at the ``TEMPLATE_DIRS`` setting. 
    390 ``TEMPLATE_DIRS`` is a tuple of filesystem directories to check when loading 
    391 Django templates. It's a search path. 
    392  
    393 The ``django-admin.py startproject`` command automatically prepopulated 
    394 this setting with the location of Django's default admin templates, according 
    395 to where you have Django installed. But let's add an extra line to 
    396 ``TEMPLATE_DIRS`` so that it checks a custom directory first, before checking 
    397 the default admin template directory:: 
     388That's easy to change, though, using Django's template system. The Django admin 
     389is powered by Django itself, and its interfaces use Django's own template 
     390system. (How meta!) 
     391 
     392Open your settings file (``myproject/settings.py``, remember) and look at the 
     393``TEMPLATE_DIRS`` setting. ``TEMPLATE_DIRS`` is a tuple of filesystem 
     394directories to check when loading Django templates. It's a search path. 
     395 
     396By default, ``TEMPLATE_DIRS`` is empty. So, let's add a line to it, to tell 
     397Django where our templates live:: 
    398398 
    399399    TEMPLATE_DIRS = ( 
    400         "/home/mytemplates/admin", 
    401         "/usr/lib/python2.3/site-packages/django/conf/admin_templates", 
     400        "/home/mytemplates", # Change this to your own directory. 
    402401    ) 
    403402 
    404 Again, note that you should edit the admin settings file, not the main settings 
    405 file. That's because we're dealing with admin-site templates. 
    406  
    407 Now copy the template ``base_site.html`` from within the default Django admin 
    408 template directory, into ``/home/mytemplates/admin`` (or wherever you're 
    409 putting your custom admin templates). Edit the file and replace the generic 
    410 Django stuff with your own site's name as you see fit. 
     403Now copy the template ``admin/base_site.html`` from within the default Django 
     404admin template directory (``django/contrib/admin/templates``) into an ``admin`` 
     405subdirectory of whichever directory you're using in ``TEMPLATE_DIRS``. For 
     406example, if your ``TEMPLATE_DIRS`` includes ``"/home/mytemplates"``, as above, 
     407then copy ``django/contrib/admin/templates/admin/base_site.html`` to 
     408``/home/mytemplates/admin/base_site.html``. 
     409 
     410Then, just edit the file and replace the generic Django text with your own 
     411site's name and URL as you see fit. 
    411412 
    412413Note that any of Django's default admin templates can be overridden. To 
     
    415416changes. 
    416417 
     418Astute readers will ask: But if ``TEMPLATE_DIRS`` was empty by default, how was 
     419Django finding the default admin templates? The answer is that, by default, 
     420Django automatically looks for a ``templates/`` subdirectory within each app 
     421package, for use as a fallback. See the `loader types documentation`_ for full 
     422information. 
     423 
     424.. _loader types documentation: http://www.djangoproject.com/documentation/templates_python/#loader-types 
     425 
    417426Customize the admin index page 
    418427============================== 
     
    426435most important page of the admin, and it should be easy to use. 
    427436 
    428 The template to customize is ``index.html``. (Do the same as with 
    429 ``base_site.html`` in the previous section -- copy it from the default directory 
    430 to your custom template directory.) Edit the file, and you'll see it uses a 
    431 template tag called ``{% get_admin_app_list as app_list %}``. That's the magic 
    432 that retrieves every installed Django app. Instead of using that, you can 
     437The template to customize is ``admin/index.html``. (Do the same as with 
     438``admin/base_site.html`` in the previous section -- copy it from the default 
     439directory to your custom template directory.) Edit the file, and you'll see it 
     440uses a template tag called ``{% get_admin_app_list as app_list %}``. That's the 
     441magic that retrieves every installed Django app. Instead of using that, you can 
    433442hard-code links to object-specific admin pages in whatever way you think is 
    434443best. 
  • django/branches/i18n/docs/tutorial03.txt

    r869 r956  
    6363 
    6464When you ran ``django-admin.py startproject myproject`` at the beginning of 
    65 Tutorial 1, it created a default URLconf in ``myproject/settings/urls/main.py``. 
    66 It also automatically set your ``ROOT_URLCONF`` setting to point at that file:: 
    67  
    68     ROOT_URLCONF = 'myproject.settings.urls.main
    69  
    70 Time for an example. Edit ``myproject/settings/urls/main.py`` so it looks like 
     65Tutorial 1, it created a default URLconf in ``myproject/urls.py``. It also 
     66automatically set your ``ROOT_URLCONF`` setting to point at that file:: 
     67 
     68    ROOT_URLCONF = 'myproject.urls
     69 
     70Time for an example. Edit ``myproject/urls.py`` so it looks like 
    7171this:: 
    7272 
     
    8585and traverses the regular expressions in order. When it finds a regular 
    8686expression that matches -- ``r'^polls/(?P<poll_id>\d+)/$'`` -- it loads the 
    87 associated Python package/module: ``myproject.polls.views.polls.detail``. That 
    88 corresponds to the function ``detail()`` in ``myproject/polls/views/polls.py``. 
     87associated Python package/module: ``myproject.apps.polls.views.polls.detail``. That 
     88corresponds to the function ``detail()`` in ``myproject/apps/polls/views/polls.py``. 
    8989Finally, it calls that ``detail()`` function like so:: 
    9090 
     
    123123Fire up the Django development Web server:: 
    124124 
    125     django-admin.py runserver --settings="myproject.settings.main" 
    126  
    127 (If you're coming here straight from Tutorial 2, note that we're now running 
    128 the server with ``--settings=myproject.settings.main`` instead of 
    129 ``--settings=myproject.settings.admin``. You'll need to restart the server to 
    130 change the ``settings`` parameter.) 
     125    django-admin.py runserver --settings=myproject.settings 
    131126 
    132127Now go to "http://localhost:8000/polls/" on your domain in your Web browser. 
     
    414409coupled to the Django settings: The URLconf. 
    415410 
    416 We've been editing the URLs in ``myproject/settings/urls/main.py``, but the 
    417 URL design of an app is specific to the app, not to the Django installation -- 
    418 so let's move the URLs within the app directory. 
    419  
    420 Create a directory ``myproject/apps/polls/urls/``, and put a blank file called 
    421 ``__init__.py`` into it. (The ``__init__.py`` file is necessary for Python to 
    422 treat the directory as a package.) Then copy the file 
    423 ``myproject/settings/urls/main.py`` to ``myproject/apps/polls/urls/polls.py``. 
    424  
    425 Then, change ``myproject/settings/urls/main.py`` to remove the poll-specific 
    426 URLs and insert an ``include()``:: 
    427  
    428 <