Thank you bro i figured it out this week end

just left with the apache problem 
i have don all the configuration but when i open my page it takes me back 
to the apache default page

skype: ngangsi.richard

On Saturday, August 9, 2014 5:23:03 PM UTC+1, Collin Anderson wrote:
>
> templates
>>
>>    1.  <img src="{{ MEDIA_URL }}{{ image.image.url }}" height="100"></a>
>>
>> should be : 
> <img src="{{ image.image.url }}" height="100">
>  
>
>> settings.py
>>
>>
>>    1. MEDIA_ROOT = '/home/yems/var/www/bluepearlhotel/media/'
>>    2. MEDIA_URL = 'http://www.127.0.0.1:8000/media/'
>>
>> You may have better luck with this simpler MEDIA_URL:
> MEDIA_ROOT = '/home/yems/var/www/bluepearlhotel/media/'
> MEDIA_URL = '/media/'
>
>
>> models.py
>>
>>
>>    - image = models.ImageField(upload_to='images/', blank=True)
>>
>> That's perfect. What does the rest of your model look like? How is it 
> connected to your Post model?
>  
>
>>
>> views .py
>>
>> def detail_post(request, blogs_id):
>>     try:
>>         blogs = Post.objects.get(pk=blogs_id)
>>     except Post.DoesNotExist:
>>         raise 404
>>     return render_to_response('detailp.html', {'blogs': blogs})
>
>
> Looks ok to me, but how does your image get into the template?
>
>>
>> urls 
>> from django.conf.urls import patterns, include, url
>>
>> from django.contrib import admin
>> admin.autodiscover()
>>
>> urlpatterns = patterns('',
>> #new urls
>>     url(r'^blog/$', 'blog.views.list_post'),
>>     url(r'^blog/(?P<blogs_id>\d+)/$', 'blog.views.detail_post'),
>>  #events urls
>>     url(r'^event/$', "event.views.list_event"),
>>     url(r'^event/(?P<events_id>\d+)/$', "event.views.detail_event"),
>>
>> #image urls
>>     url(r'^gallery/$', "gallery.views.list_gallery"),
>>     url(r'^gallery/(?P<gallery_id>\d+)/$', 
>> "gallery.views.detail_gallery"),
>>     
>> #url(r'^gallery/(?P<galley_id>\d+)/album/$',"gallery.views.detail_album"),
>>
>>  #HOME URL
>>     url(r'^home/$', "home.views.list_home"),
>>     url(r'^home/(?P<homes_id>\d+)/$', "home.views.detail_home"),
>>
>>
>>
>>     url(r'^admin/', include(admin.site.urls)),
>>
>> )
>
> add a static() line for you MEDIA_ROOT at the very bottom:
>
> from django.conf import settings
> from django.conf.urls.static import static
>
> urlpatterns = patterns('',
>     # ... the rest of your URLconf goes here ...
> ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
>
>
>
> https://docs.djangoproject.com/en/1.7/howto/static-files/#serving-files-uploaded-by-a-user-during-development
>  
>

-- 
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+unsubscr...@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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aeb926d6-fc20-44c8-bb9c-04e32e8680d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to