python - Django is not rendering second applications HTML -


i've added second application using:

python manage.py startapp 

in project. rendering first applications view, no matter url put on.

ex. http://127.0.0.1:8000/aldsjfal/asdfadsfa/adsfasdf/adfadsf/

here settings.py:

""" django settings mysite project.  generated 'django-admin startproject' using django 1.9.  more information on file, see https://docs.djangoproject.com/en/1.9/topics/settings/  full list of settings , values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """  import os ################################################################################ #                                      dependencies                            # ################################################################################ import os.path                                                                #  #                                                                              # # note use os.path construct absolute path. ensures django# # can locate files unambiguously staticfiles_dirs. - lt 16jan2016      #                       #                                                                              # #                                                                              # #                                                                              # ################################################################################  # build paths inside project this: os.path.join(base_dir, ...) base_dir = os.path.realpath(os.path.dirname(__file__))   # quick-start development settings - unsuitable production # see https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/  # security warning: keep secret key used in production secret! secret_key = '*ih=!lu+z1=5sk8&ool2hmryc07rbuhjwy*3745=i6@$w)joo7'  # security warning: don't run debug turned on in production! debug = true  allowed_hosts = ['*']  temp_path = os.path.realpath('.')  project_path = os.path.realpath(os.path.dirname(__file__))  media_root = project_path + '/media/'   # application definition  installed_apps = [      'about.apps.aboutconfig',     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles',     'home.apps.homeconfig', ]  middleware_classes = [     'django.middleware.security.securitymiddleware',     'django.contrib.sessions.middleware.sessionmiddleware',     'django.middleware.common.commonmiddleware',     'django.middleware.csrf.csrfviewmiddleware',     'django.contrib.auth.middleware.authenticationmiddleware',     'django.contrib.auth.middleware.sessionauthenticationmiddleware',     'django.contrib.messages.middleware.messagemiddleware',     'django.middleware.clickjacking.xframeoptionsmiddleware', ]  root_urlconf = 'mysite.urls'  templates = [     {         'backend': 'django.template.backends.django.djangotemplates',         'dirs': [os.path.join(base_dir, 'templates'),         ],         'app_dirs': true,         'options': {             'context_processors': [                 'django.template.context_processors.debug',                 'django.template.context_processors.request',                 'django.contrib.auth.context_processors.auth',                 'django.contrib.messages.context_processors.messages',              ],         },     }, ]  wsgi_application = 'mysite.wsgi.application'   # database # https://docs.djangoproject.com/en/1.9/ref/settings/#databases  databases = {     'default': {         'engine': 'django.db.backends.sqlite3',         'name': os.path.join(base_dir, 'db.sqlite3'),     } }   # password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators  auth_password_validators = [     {         'name': 'django.contrib.auth.password_validation.userattributesimilarityvalidator',     },     {         'name': 'django.contrib.auth.password_validation.minimumlengthvalidator',     },     {         'name': 'django.contrib.auth.password_validation.commonpasswordvalidator',     },     {         'name': 'django.contrib.auth.password_validation.numericpasswordvalidator',     }, ]   # internationalization # https://docs.djangoproject.com/en/1.9/topics/i18n/  language_code = 'en-us'  time_zone = 'america/los_angeles'  use_i18n = true  use_l10n = true  use_tz = true   # static files (css, javascript, images) # https://docs.djangoproject.com/en/1.9/howto/static-files/  static_url = '/static/'   staticfiles_dirs = (     os.path.join(base_dir, 'static'), )  site_root = os.path.dirname(os.path.realpath(__file__)) 

----------------------------------edit 1----------------------------------

here urls.py root project:

"""mysite url configuration  `urlpatterns` list routes urls views. more information please see:     https://docs.djangoproject.com/en/1.9/topics/http/urls/ examples: function views     1. add import:  my_app import views     2. add url urlpatterns:  url(r'^$', views.home, name='home') class-based views     1. add import:  other_app.views import home     2. add url urlpatterns:  url(r'^$', home.as_view(), name='home') including urlconf     1. add import:  blog import urls blog_urls     2. import include() function: django.conf.urls import url, include     3. add url urlpatterns:  url(r'^blog/', include(blog_urls)) """ django.conf.urls import include, url django.contrib import admin  admin.autodiscover()  urlpatterns = [     url(r'^about/', include('about.urls'), name ='about'),     url(r'^', include('home.urls'), name ='index'),     url(r'^admin/', admin.site.urls), ] 

here first application urls.py:

from django.conf.urls import url django.conf import settings django.conf.urls.static import static  app_name = 'home'  . import views urlpatterns = [      url(r'^', views.index, name ='index'),   ] 

here second applications urls.py:

from django.conf.urls import url django.conf import settings django.conf.urls.static import static  app_name = 'about'  . import views urlpatterns = [      url(r'^/about/$', views.about, name ='about'),   ] 

the order of url patterns matter. return first matching pattern @ top of list, though there more specific pattern @ bottom of list.

also pattern like: r’^‘ match anything. including: http://127.0.0.1:8000/abc/def/ghi/. however, such pattern include nested urlpattern, closed kind of r'^$', match nothing more.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -