ok i did all steps but it still doesn't work .. this is my settings.py file 
:
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
STATICFILES_STORAGE = 
'whitenoise.storage.CompressedManifestStaticFilesStorage'

DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage'
DROPBOX_OAUTH2_TOKEN = 
'hSRexFBHo-AAAAAAAAAAWVBZOhZJo6jrIP3NgMK0L_7aWHkb0mJs-z4IWO6b_EBk'
DROPBOX_ROOT_PATH = '/arenaimages/'

and this is admin.py :
from django.contrib import admin
from imagekit.admin import AdminThumbnail
from .models import MapData
# Register your models here.

from .models import League, LeagueNews, Comment, Club, Match
admin.site.register(League)
admin.site.register(LeagueNews)
admin.site.register(Comment)

class ClubAdmin(admin.ModelAdmin):
fields = ['league_names', 'name', 'year_of_establishment', 'logo', 'won', 
'draw', 'lost', 'total_points', 'goal_for', 'goal_against', 'goal_diff']
logo = AdminThumbnail(image_field='image')
readonly_fields = ('total_points', 'goal_diff',)

admin.site.register(Club, ClubAdmin)
admin.site.register(Match)
thanks joe

On Friday, June 14, 2019 at 12:31:31 PM UTC+2, Joe Reitman wrote:
>
> Yes. Generate an access token from your Dropbox App Console and put it in 
> your settings.py. The token is used to authenticate your Django app with 
> your Dropbox app.
>
> DROPBOX_ROOT_PATH is the folder in your Dropbox App where you want to 
> store your photos. You need to define it with this variable in settings.py.
>  Typically I call it 'images' like this:  
> DROPBOX_ROOT_PATH = '/images/'
>
>
> On Thursday, June 13, 2019 at 3:44:20 PM UTC-5, omar ahmed wrote:
>>
>> i did first and second steps
>> but what about 
>> DROPBOX_OAUTH2_TOKEN = your token from dropbox
>> did you mean Generate access token ??
>> DROPBOX_ROOT_PATH = your root path to store media
>> did you mean link to Dropbox app folder ?
>> thanks
>> On Thursday, June 13, 2019 at 6:15:02 PM UTC+2, Joe Reitman wrote:
>>>
>>> Omar, 
>>>
>>> You should not be configuring views for Dropbox. DJANGO-STORAGES does 
>>> all the back end coding for you.
>>>
>>> Follow these steps from DJANGO-STORAGES documentation after removing the 
>>> code changes you made to views. I'm assuming your using pip.
>>>
>>> 1. pip install django-storages
>>> 2. pip install dropbox
>>> 3. In your settings.py set these variables
>>>     DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage'
>>>     DROPBOX_OAUTH2_TOKEN = your token from dropbox
>>>     DROPBOX_ROOT_PATH = your root path to store media
>>> FROM THE DROPBOX DOCUMENTATION TUTORIAL YOU ONLY NEED TO REGISTER YOUR 
>>> APP AND GENERATE YOUR OAUTH2 TOKEN. DISREGARD THE 'LINK YOUR ACCOUNT'. 
>>> DJANGO STORAGES DOES THAT FOR YOU.
>>>
>>> 4. pip install django-imagekit and add it to your settings.py 'installed 
>>> apps' -read the docs <https://django-imagekit.readthedocs.io/en/latest/> 
>>> on this one
>>>
>>> Now you need to have an imagefield in your model and config your 
>>> admin.py as I explained earlier. 
>>> I highly recommend creating an app to do this functionality. Call it 
>>> something like 'logo upload'. Django best practices says an app does one 
>>> thing and does it well.
>>>
>>>
>>> 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/cbb27d35-5fbf-492e-8953-e474306e43ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to