These are chat archives for django/django

28th
Apr 2016
Italo Maia
@imaia
Apr 28 2016 13:12 UTC
hello folks!
I'm having a hard time creating test only models; this error pops up doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
suggestions?
Joan Ngatia
@JoanNgatia
Apr 28 2016 14:00 UTC
@imaia have you added the name of the app that holds the models in the INSTALLED_APPS list on your settings.py?
Italo Maia
@imaia
Apr 28 2016 14:52 UTC
yeap
what holds the model is the app.tests; added with modify_settings without avail
Alex
@ajbeach2
Apr 28 2016 17:26 UTC
does anyone have any insight as to why this library says to only use in admin?
https://github.com/bradleyg/django-s3direct
Mir Nazim
@mnazim
Apr 28 2016 17:29 UTC
It's not saying that @ajbeach2 . It's a section that tells you how to use it in admin only. Readme also has a section title Use the widget in a custom form which shows you how to use it in you own forms
Alex
@ajbeach2
Apr 28 2016 17:29 UTC
ah ok, that is confusing
Mir Nazim
@mnazim
Apr 28 2016 17:30 UTC
Also take a look at django-storages. It might be better suited for the job.
Alex
@ajbeach2
Apr 28 2016 17:30 UTC
does that allow direct uploads from the clients though?
i want to by-pass the server for uploads
Mir Nazim
@mnazim
Apr 28 2016 17:31 UTC
I don't think you can do that with either of these libraries.
Alex
@ajbeach2
Apr 28 2016 17:31 UTC
that is what the django-s3direct does
mpachas
@mpachas
Apr 28 2016 17:32 UTC
S3 direct does. I've only tested in admin, but it should work.
Mir Nazim
@mnazim
Apr 28 2016 17:33 UTC
s3 direct means your app sever is pushing files directly to s3 instead of first storing them locally. It does not mean uploads from the browser are directly going to s3. Server is still in picture, just not storing files locally
Alex
@ajbeach2
Apr 28 2016 17:33 UTC
right it does some sort of signed url thing
Mir Nazim
@mnazim
Apr 28 2016 17:34 UTC
Look at it like this. You are configuring S3 in your django settings, django app runs on server.
So your server will still be in the picture.
Mir Nazim
@mnazim
Apr 28 2016 17:35 UTC
It's not your browser uploading to s3. it;s your django app. S3 response is then used to extract information to store in file field so that url points to S3 urls not local url
Okay my bad. Looks like it's doing exactly what you are saying.
Haven't tried it myself though. Thanks for link to heroku article. Reading now
Alex
@ajbeach2
Apr 28 2016 17:38 UTC
@mpachas is there any reason you can think of where you wouldn't want to use that s3direct library outside of admin? as a user facing form?
Mir Nazim
@mnazim
Apr 28 2016 17:39 UTC
If you need to process the files after uploading, then direct to S3 is not an optimal solution.
Alex
@ajbeach2
Apr 28 2016 17:40 UTC
it is though, i would use AWS lambda
that is also the aws docs for processing images
you have a lambda, it grabs it from the bucket, processes it, puts it in another bucket
blob
Mir Nazim
@mnazim
Apr 28 2016 17:41 UTC
And you will also need a way to convey the new image's existence to your django app too.
mpachas
@mpachas
Apr 28 2016 17:41 UTC
@ajbeach2 you don't know what could be uploaded to your bucket, but I think there is no problem. Just follow github instructions to make it work in a custom form
Alex
@ajbeach2
Apr 28 2016 17:43 UTC
@mnazim you could do that based on the paths in s3
/origina/, and /processed/ or something
i would probably need a callback endpoint or something though
for other reasons
@mpachas yeah, it seems like s3 bucket policy, you can't actually validate the content type in a post policy i don't think
im not sure though, need to google more
Puneet Aggarwal
@puneetagg
Apr 28 2016 18:54 UTC
hi..
Hi..
I am new to PyCharm. Please help me in running the project from PyCharm.
Long Huynh
@itslonghuynh
Apr 28 2016 22:18 UTC
@puneetagg What do you need help exactly?