Did you create a processed image field in your model?
On Friday, June 14, 2019 at 7:50:41 AM UTC-5, omar ahmed wrote:
-- On Friday, June 14, 2019 at 7:50:41 AM UTC-5, omar ahmed wrote:
ok i did all steps but it still doesn't work .. this is my settings.py file :and this is admin.py :PROJECT_ROOT = os.path.dirname(os.path.abspath( __file__))STATIC_URL = '/static/'STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesS torage' DEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage' DROPBOX_OAUTH2_TOKEN = 'hSRexFBHo-AAAAAAAAAAWVBZOhZJo6jrIP3NgMK0 L_7aWHkb0mJs-z4IWO6b_EBk' DROPBOX_ROOT_PATH = '/arenaimages/'thanks joefrom django.contrib import adminfrom imagekit.admin import AdminThumbnailfrom .models import MapData# Register your models here.from .models import League, LeagueNews, Comment, Club, Matchadmin.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)
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 aboutDROPBOX_OAUTH2_TOKEN = your token from dropboxdid you mean Generate access token ??did you mean link to Dropbox app folder ?DROPBOX_ROOT_PATH = your root path to store media
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-storages2. pip install dropbox3. In your settings.py set these variablesDEFAULT_FILE_STORAGE = 'storages.backends.dropbox.DropBoxStorage' DROPBOX_OAUTH2_TOKEN = your token from dropboxDROPBOX_ROOT_PATH = your root path to store mediaFROM 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 on this oneNow 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+unsubscribe@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/10cb129c-3dc1-4a0e-ae7c-68a665c93dca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment