I have two different directory for both media and static. And as I upload the files through the local server (localhost:8000), I can see the uploaded images both by the local server and the apache server. However, when I upload it with apache(localhost), I can't see them. I can only see the static. But when I reload the page served by the local server (not runserver again), I can then see those pictures both by the local server and the apache. What am I doing wrong? Any help will be appreciated. Thank you.
settings.py:
MEDIA_ROOT = 'C:/Users/Robin/media' MEDIA_URL = '/media/' STATIC_ROOT = 'C:/Users/Robin/static/' STATIC_URL = '/static/' STATICFILES_DIRS = ( "C:/Users/Robin/web/leo/static", )http.conf:
WSGIScriptAlias / C:/Users/Robin/web/leo/leo/wsgi.py WSGIPythonPath C:/Users/Robin/web/leo <Directory C:/Users/Robin/web/leo> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> #Alias /robots.txt /path/to/mysite.com/static/robots.txt #Alias /favicon.ico /path/to/mysite.com/static/favicon.ico AliasMatch ^/([^/]*\.css) C:/Users/Robin/static/styles/$1 Alias /media/ C:/Users/Robin/media/ Alias /static/ C:/Users/Robin/static/ <Directory C:/Users/Robin/static> Order deny,allow Allow from all </Directory> <Directory C:/Users/Robin/media> Order deny,allow Allow from all </Directory> WSGIScriptAlias / C:/Users/Robin/web/leo/leo/wsgi.py <Directory C:/Users/Robin/web/leo/leo> <Files wsgi.py> Order allow,deny Allow from all </Files> </Directory> urls.py:
from django.conf.urls import patterns, include, url from django.conf import settings from django.conf.urls.static import static from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'leo.views.home', name='home'), url(r'^home/', include('status.urls')), url(r'^gallery/$', 'leo.views.gallery'), url(r'^mypage/$', 'leo.views.mypage'), # Accounts url(r'^please_login/$', 'leo.views.please_login'), url (r'^accounts/auth_view/$', 'leo.views.auth_view'), url (r'accounts/register/$', 'leo.views.register_user'), url (r'register_success/$', 'leo.views.register_success'), url (r'^accounts/loggedin/$', 'leo.views.loggedin'), url (r'^accounts/invalid/$', 'leo.views.invalid_login'), url (r'^accounts/logout/$', 'leo.views.logout'), url(r'^admin/', include(admin.site.urls)), ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
.html:
{% block content %} <div class="status"> <div class="inner"> {% for Status in status %} <p class="user">{{ Status.creator.get_full_name }}</p> {% if Status.image %} <div class="image_image"> <center> <img src="{{Status.image |thumbnail_url:'status'}}"/> </center> </div> <p class="status_image">{{Status}}</p> <span class="clear"></span> <hr> {% else %} <p class="status_status">{{Status}}</p> <span class="clear_right"></span> <hr> {% endif %} {% endfor %} </div> </div> {% endblock %}
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment