Setting django to server media files from google cloud - python

I'm trying to deploy my project in Heroku but the media files (images) are deleted , so someone told me that i need to use a service called "Google cloud", my question is, how to configure my prject to use that service. Can somebody help me?

You can also use Amazon web services S3 buckets here is a link:
Link to guide on how to serve media and static files from AWS S3 to a Django app deployed on heroku

Related

Images not loading when deploying Django app to Heroku

I deployed my app to heroku: https://doggos-only.herokuapp.com/
The images on the Dog Images link work locally, but they do not work on the deployed version. The only useful error I'm getting is: cj_eOAaboi.jpg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
My best guess is that it has something to do with the file path, but I'm not sure. I've tried looking around the web for a solution but have been unable to find one. Looking for any help, here is the repo: https://github.com/jpchato/doggos_only_project
I'm deploying from the deploy_branch in my repo.
That's because media files (Those files uploaded by the user) in heroku are not persistent, that means that after a certain time all the media will be erased.
I strongly suggest you to use a media CDN like cloudinary or amazon s3.
I wrote a post on how to setup a media CDN with cloudinary for free and you can access it right here
Django Tutorial: Set up Media files in Deployment for FREE

Django static files not being served by amazon s3 even though all the instructions have been strictly followed

This is my first time ever on this platform, so please don't mind me if I am breaching any rules. I just finished building my first django project and I am using an amazon s3 bucket to serve media and static files. I have deployed the app onto heroku but static and media files are not being loaded. When I inspect the page, I see that it is throwing a 403 error. All the policies of my bucket have been set as prescribed in the documentation. below is a picture of my relevant setting.py
settings .py

Making GCP bucket default storage in Django

I am not using App Engine.
I have deployed my Django server in my GCP instance and using Django root location for the storage. However, I want to access the GCP bucket and make it as the default storage location for uploading and sending the path to the function used in the views.py
Here's a link Configure Django and Google Cloud Storage?
From the URL above, I think that the issue can be solved but I'm unable to understand where to deploy the code: settings.py or views.py?
Is it possible that someone can help me with steps?

How can I edit the NGINX configuration on Google App Engine flexible environment?

How can I edit the Google App Engine NGINX configuration?
There doesn't seem to be much support in the Google docs in regards to the NGINX configuration for apps running in the Google App Engine flexible environment.
My app is running fine, but I get this 413 error when I try and upload an audio file (.wav or .mp3).
413 Request Entity Too Large -- nginx
My app is running Django (python 3), with Cloud Postgres SQL and Cloud Storage enabled.
I researched the error, and it seems I can set a nginx.config file so that it includes "client_max_body_size 80M" - but like I said, there is no documentation regarding how to manually config NGINX on deploy.
Any suggestions?
You should be able to create a nginx-app.conf file in the same directory as your app.yaml file. There is an example of using the nginx configuration file in a Flex environment located here: https://github.com/GoogleCloudPlatform/getting-started-php/tree/master/4-auth .
This same file is referenced in Google's documentation here: https://cloud.google.com/appengine/docs/flexible/php/runtime#customizing_nginx
Once you have that file created, you should be able to add any property you need and then rebuild your project to see the changes take effect.
So upon contacting Google Support, the suggested solution for uploading files larger than 32MB is as follows:
"The way to circumvent App Engine's 32MB limit is to send the requests directly to Cloud Storage, for instance using the resumable upload process. You can still use App Engine to serve your app, but the clientside portion of the app would be the one handling the upload to Google Cloud Storage. For this you would have your application generate a signed URL which the client can use to gain access to your Cloud Storage bucket for the purpose of uploading an image."
I went with this solution. It saves money in the end.

how to upload python application with google apps?

I developed one application and upload on example.appspot.com
now i want to upload it on www.example.com
what to do???
pls reply fast..
Actually, your application has to be hosted by GAE, but you can set a domain for it.

Categories