python - How to add app image path to urls.py? -
when run app on localhost try show random banners configured using adzone, when load home page can't see images used banners, problem path images /media/adzone/bannerads/image.jpg , path automatically used app, , cant change it. how can tell app images there?
my settings.py :
""" django settings ciudad_tenis 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, ...) # 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 = '###############################################' # 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', 'django.contrib.sites', 'news', 'tournaments', 'rules', 'finalists', 'courts', 'adzone', ) 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', ) template_context_processors = ( 'django.contrib.auth.context_processors.auth', # , add request if didn't 'django.core.context_processors.request', 'adzone.context_processors.get_source_ip', ) authentication_backends = ( 'django.contrib.auth.backends.modelbackend', ) facebook_app_id = '##################' facebook_app_secret = '##############################' root_urlconf = 'ciudad_tenis.urls' wsgi_application = 'ciudad_tenis.wsgi.application' # internationalization # https://docs.djangoproject.com/en/1.7/topics/i18n/ language_code = 'es' time_zone = 'america/argentina/buenos_aires' use_i18n = true use_l10n = true use_tz = true # honor 'x-forwarded-proto' header request.is_secure() secure_proxy_ssl_header = ('http_x_forwarded_proto', 'https') # allow host headers allowed_hosts = ['*'] # parse database configuration $database_url import dj_database_url databases = { 'default': { 'engine': 'django.db.backends.mysql', 'name': 'ciudad_tenis', 'host': '127.0.0.1', 'port': '3306', 'user': 'root', 'password': '', }} site_id = '1' # honor 'x-forwarded-proto' header request.is_secure() secure_proxy_ssl_header = ('http_x_forwarded_proto', 'https') # allow host headers allowed_hosts = ['*'] # static asset configuration import os base_dir = os.path.abspath(os.path.dirname(__file__)) static_url = '/static/' staticfiles_dirs = ( os.path.join(base_dir, 'static'), ) template_dirs = ( os.path.join(os.path.dirname(__file__), 'templates'), ) media_root = os.path.join(base_dir, 'media') media_url = '/media/'
my urls.py:
from django.conf.urls import patterns, include, url django.contrib import admin news import views django.views.generic import templateview django.conf import settings django.conf.urls.static import static urlpatterns = patterns('', # examples: url(r'^$', templateview.as_view(template_name='home.html'), name="home"), # url(r'^blog/', include('blog.urls')), url(r'^novedades/', include('news.urls', namespace="news")), url(r'^admin/', include(admin.site.urls)), url(r'^torneos/', include('tournaments.urls', namespace="tournaments")), url(r'^reglas/', include('rules.urls', namespace="rules")), url(r'^ganadores/', include('finalists.urls', namespace="finalists")), url(r'^canchas/', include('courts.urls', namespace="fields")), url(r'^adzone/', include('adzone.urls')), ) + static(settings.static_url, document_root=settings.static_root)
my app structure:
myapp/ myapp/ static/ templates/ urls.py settings.py wsgi.py __init__.py adzone/ bannerads/ locale/ south_migrations/ templates/ templatestags/ models.py urls.py managers.py admin.py tests.py views.py other_app/ migrations/ static/ templates/ models.py admin.py urls.py views.py tests.py __init__.py
Comments
Post a Comment