Re: broken image on my django production site. Why is it?

2014-11-02 Thread Collin Anderson
Hello,

You may need to install something like dj-static to serve your files.

Collin

-- 
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/16d1430f-b32f-4f3d-b12c-18e9920b4e69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: broken image on my django production site. Why is it?

2014-11-02 Thread Kakar Nyori
I think, you should add "static"/ in your html:



Or else change your directory settings.


On Sat, Nov 1, 2014 at 8:21 PM, rdyact  wrote:

>
> 
> I just product my site using Heroku and I got a odd problem with my media
> images broken. Here is my site structure on Heroku.
>
>  -- app
> -- manage.py
> -- mysite
>-- settings
>  -- __init__.py
>  -- base.py
>  -- production.py
> -- static
>-- media
>   -- product
> -- images
>   --
>-- static_dirs
>-- static_root
>
>
> In my app/mysite/settings/ *init*.py
>
> from .base import *try:
> from .local import *
> live = Falseexcept:
> live = Trueif live:
> from .production import *
>
> and in my base.py
>
> import os
> BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
> STATIC_URL = '/static/'
> MEDIA_URL = '/media/'
> MEDIA_ROOT = os.path.join(BASE_DIR, 'static', 'media')
> STATIC_ROOT = os.path.join(BASE_DIR, 'static', 'static_root')
> STATICFILES_DIRS = (
> os.path.join(BASE_DIR, 'static', 'static_dirs'),)
> TEMPLATE_DIRS = (
> os.path.join(BASE_DIR, 'templates'),)
>
>
> and in my production.py, I annotated as below.
>
> # Static asset configuration# import os# BASE_DIR = 
> os.path.dirname(os.path.abspath(__file__))# STATIC_ROOT = 'staticfiles'# 
> STATIC_URL = '/static/'# STATICFILES_DIRS = (# os.path.join(BASE_DIR, 
> 'static'),# )
>
> Finally, I ran server and I got still broken image shown on my page. When
> I look the image carefully through "google inspect element",I can still see
> the probably right path as below.
>
> 
>
> But when I see my /static/media/products/images/ folder, there were images
> created on development statge only, not the images I just created on
> production site. (aws.png)
>
> As still beginner for django development, It is a tough to find answer
> even after few hour's googling.
>
> Thanks always.
>
>
>  --
> 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/2f1eb33e-c1c0-417f-8665-b8f239540f4d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2B8okoLAeWvJKPDYAGcLR7XYOMDT1CohqcZWEsek3PtbpZdzXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


broken image on my django production site. Why is it?

2014-11-01 Thread rdyact



I just product my site using Heroku and I got a odd problem with my media 
images broken. Here is my site structure on Heroku.

 -- app
-- manage.py
-- mysite
   -- settings
 -- __init__.py
 -- base.py
 -- production.py
-- static
   -- media
  -- product
-- images
  -- 
   -- static_dirs
   -- static_root


In my app/mysite/settings/ *init*.py

from .base import *try:
from .local import *
live = Falseexcept:
live = Trueif live:
from .production import *

and in my base.py

import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static', 'media')
STATIC_ROOT = os.path.join(BASE_DIR, 'static', 'static_root')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static', 'static_dirs'),)
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),)


and in my production.py, I annotated as below.

# Static asset configuration# import os# BASE_DIR = 
os.path.dirname(os.path.abspath(__file__))# STATIC_ROOT = 'staticfiles'# 
STATIC_URL = '/static/'# STATICFILES_DIRS = (# os.path.join(BASE_DIR, 
'static'),# )

Finally, I ran server and I got still broken image shown on my page. When I 
look the image carefully through "google inspect element",I can still see 
the probably right path as below.



But when I see my /static/media/products/images/ folder, there were images 
created on development statge only, not the images I just created on 
production site. (aws.png)

As still beginner for django development, It is a tough to find answer even 
after few hour's googling.

Thanks always.


-- 
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/2f1eb33e-c1c0-417f-8665-b8f239540f4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.