Omar,

You need to put the image in your 'static' files directory. 

<img src="/media/media/core/sevilla.png" alt="Seville logo" height="100" 
width="100">



On Monday, June 10, 2019 at 2:37:58 PM UTC-5, omar ahmed wrote:
>
> almost i did all of these instructions 
> collectstatic - DEBUG = True  - install and use whitenoise in my app 
> the problem is heroku is ephemeral ( that's mean image clubs appear and 
> after one hour it disappear )
> i want to use something like Dropbox (permenant) but i don't know how to  
> make it my media folder 
>
>
> On Monday, June 10, 2019 at 10:57:23 AM UTC+2, Joe Reitman wrote:
>>
>> A couple of things to check.
>> <img src="/media/media/core/sevilla.png" alt="إشبيلية logo" height="100" 
>> width="100">
>> 1. Is the photo located in directory above?
>> 2. Did you run collectstatic?
>> 3. In your settings.py are STATIC_ROOT, STATIC_URLS and STATICFILES_DIRS 
>> configured
>> 4. In your template you have setup like this example:
>>
>> {% load static %}<img src="{% static "my_app/example.jpg" %}" alt="My image">
>>
>>
>> Also, it looks like you have DEBUG set to True. When DEBUG is set to 
>> True, Django will use it's development static file server to serve static 
>> files. However, setting DEBUG true in production is not recommended. 
>>
>> Note that when you set DEBUG to False, the Django static file server is 
>> disabled. Hence the need to host static files on a CDN *or* using a 
>> static file server like Whitenoise. You can serve static files within your 
>> Django app using Whitenoise <http://whitenoise.evans.io/en/stable/> and 
>> is recommended by Heroku 
>> <https://devcenter.heroku.com/articles/django-assets#whitenoise>. The 
>> other option is to serve static files from external sources.
>>
>> If you only have one photo, you can do what I suggested using codepen.io 
>> or surge.sh or almost any other remote storage that allows you to 
>> 'hotlink' <https://simple.wikipedia.org/wiki/Hotlinking> image files.
>>
>>
>> On Sunday, June 9, 2019 at 9:17:42 PM UTC-5, omar ahmed wrote:
>>>
>>> this is explanation for my problem 
>>> my site is for football news My Media Files are uploaded to the app but 
>>> then disappear .... like clubs logo here 
>>> https://arena3.herokuapp.com/8/clubpage/
>>> when i created any club logo appear but after minutes disappear 
>>> i don't mean files uploaded by the users ( but by me in admin dashboard)
>>>
>>> On Sunday, June 9, 2019 at 11:16:19 PM UTC+2, Joe Reitman wrote:
>>>>
>>>> Omar,
>>>>
>>>> Looking at your original request I misunderstood what you wanted to do. 
>>>> I thought you wanted to configure media files which are uploaded by the 
>>>> user. 
>>>>
>>>> For static files you have many free options to store them and put the 
>>>> links in your img tags. If you have a codepen.io account, you can 
>>>> upload your images to codepen and use the links generated by codepen. 
>>>> Another option is to install surge.sh and upload images to a surge static 
>>>> site and then use the links to the images. If that makes sense.
>>>>
>>>> I have used both options to store my static files in various projects. 
>>>> These options are good for testing and development.
>>>>
>>>> On Sunday, June 9, 2019 at 9:07:01 AM UTC-5, omar ahmed wrote:
>>>>>
>>>>> i installed Dropbox for django environment 
>>>>> but how to link an account and adjust settings 
>>>>> tutorial is not clear
>>>>> thanks
>>>>>
>>>>> On Saturday, June 8, 2019 at 8:23:08 PM UTC+2, Joe Reitman wrote:
>>>>>>
>>>>>> Follow the django-storages documentation. 
>>>>>> https://django-storages.readthedocs.io/en/latest/backends/dropbox.html
>>>>>>
>>>>>> It's easy to setup.
>>>>>>
>>>>>> On Saturday, June 8, 2019 at 8:23:17 AM UTC-5, omar ahmed wrote:
>>>>>>>
>>>>>>> ok joe .... how can i use Dropbox for this issue ..
>>>>>>>
>>>>>>> On Saturday, June 8, 2019 at 2:59:20 AM UTC+2, Joe Reitman wrote:
>>>>>>>>
>>>>>>>> Omar,
>>>>>>>>
>>>>>>>> I use Dropbox which is free up to 2GB. I installed django-storages 
>>>>>>>> library to make setting up Dropbox easy.  
>>>>>>>>
>>>>>>>> On Friday, June 7, 2019 at 6:32:21 PM UTC-5, omar ahmed wrote:
>>>>>>>>>
>>>>>>>>> hii ..
>>>>>>>>> i deployed my first django app on Heroku 
>>>>>>>>> https://arena3.herokuapp.com/
>>>>>>>>> but my media files ( like club logo ) disappear or deleted ... 
>>>>>>>>> i found this article on Heroku 
>>>>>>>>> https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted
>>>>>>>>>   
>>>>>>>>>
>>>>>>>>> that means The Heroku filesystem is ephermal and i should use aws 
>>>>>>>>> but it's not free ?
>>>>>>>>> is there any solution ?
>>>>>>>>> how can i use Heroku postgres (addons) to upload my files 
>>>>>>>>> permanently .. thanks in advance
>>>>>>>>>
>>>>>>>>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/061e5a5c-e377-4ecb-a406-44667f083e3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to