python - Django Looking for URLS of a Different Project -
i have 2 projects in django i´m working on @ same time. today strange happened after switching projects.
i have first project: urls.py , manage.py
from django.conf.urls import patterns, include, url django.contrib import admin django.conf import settings django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # examples: # url(r'^$', 'agenda.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^agenda/', include('modulo_agenda.urls')), url(r'^schedule/', include('schedule.urls')), ) """ django settings agenda project. more information on file, see https://docs.djangoproject.com/en/1.7/topics/settings/ full list of settings , values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # build paths inside project this: os.path.join(base_dir, ...) import os project_root = os.path.abspath( os.path.join(os.path.dirname(__file__), ".."), ) base_dir = os.path.dirname(os.path.dirname(__file__)) template_path = os.path.join(base_dir, 'templates') template_dirs = ( # put strings here, "/home/html/django_templates" or "c:/www/django/templates". # use forward slashes, on windows. # don't forget use absolute paths, not relative paths. template_path, ) project_dir = os.path.abspath(os.path.dirname(__file__)) # quick-start development settings - unsuitable production # see https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # security warning: keep secret key used in production secret! secret_key = '@7j23xm3jv=(#gicejabv2ppa$063st+d@)2x^thld0(#!chwq' # security warning: don't run debug turned on in production! debug = true template_debug = true allowed_hosts = [] # application definition installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'modulo_agenda', 'schedule', 'djangobower', ) middleware_classes = ( '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', 'django.middleware.locale.localemiddleware', ) root_urlconf = 'agenda.urls' wsgi_application = 'agenda.wsgi.application' # database # https://docs.djangoproject.com/en/1.7/ref/settings/#databases databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'db.sqlite3'), } } # internationalization # https://docs.djangoproject.com/en/1.7/topics/i18n/ language_code = 'en-us' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true media_root = os.path.join(project_dir, "site_media") admin_media_prefix = '/media/' media_url = '/site_media/' # static files (css, javascript, images) # https://docs.djangoproject.com/en/1.7/howto/static-files/ static_url = '/static/' static_root = os.path.join(project_root, 'static') template_context_processors = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.request", ) staticfiles_finders = ( 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', 'djangobower.finders.bowerfinder', ) bower_path = 'c:/python34/lib/site-packages' bower_components_root = os.path.join(project_root, "components") bower_installed_apps = ( 'jquery', 'bootstrap' ) first_day_of_week = 1 # monday root_urlconf = 'agenda.urls'
and second project settings , urls:
from django.conf.urls import patterns, include, url django.contrib import admin urlpatterns = patterns('', # examples: # url(r'^$', 'proyecto_final_web.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^music/', include('music_manager.urls')), ) """ django settings proyecto_final_web project. more information on file, see https://docs.djangoproject.com/en/1.7/topics/settings/ full list of settings , values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # build paths inside project this: os.path.join(base_dir, ...) import os base_dir = os.path.dirname(os.path.dirname(__file__)) # quick-start development settings - unsuitable production # see https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # security warning: keep secret key used in production secret! secret_key = '=%65sc*)pue#)wj&pxd#meh3s_v(^s***+ns(p*8_@pjla_+xo' # security warning: don't run debug turned on in production! debug = true template_debug = true allowed_hosts = [] # application definition installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ) middleware_classes = ( '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 = 'proyecto_final_web.urls' wsgi_application = 'proyecto_final_web.wsgi.application' # database # https://docs.djangoproject.com/en/1.7/ref/settings/#databases databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'db.sqlite3'), } } # internationalization # https://docs.djangoproject.com/en/1.7/topics/i18n/ language_code = 'en-us' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true # static files (css, javascript, images) # https://docs.djangoproject.com/en/1.7/howto/static-files/ static_url = '/static/' template_path=os.path.join(base_dir, 'templates') template_dirs = (template_path,) static_path = os.path.join(base_dir,'static') staticfiles_dirs = ( static_path, )
the problem i´m having when type run server on agenda project get:
system check identified no issues (0 silenced). august 30, 2015 - 13:33:04 django version 1.7, using settings 'agenda.settings' starting development server @ http://127.0.0.1:8000/ quit server ctrl-break.
it´s saying using agenda.settings, has root_urlconf = 'agenda.urls'
but when trying go url localhots:8000/schedule error:
using urlconf defined in proyecto_final_web.urls, django tried these url patterns, in order: ^admin/ ^music/ current url, schedule/, didn't match of these.
which urls defined in other project. don´t understand why happens since on runserver saying it´s using agenda.settings , not proyecto_final_web.settings.
can tell me might happening?
judging code above, there seems error in project_root
settings. 1 project has project_root
setting defined , other project not seem have setting.
you need ensure project_root
has been defined correctly , both projects.
Comments
Post a Comment