How to dispalay icons of django site after deploying - django

Hello I recently deployed a django website on heroku and used aws to store my media and static files, the site was deployed successfully except i cant find the icons used by the template on production but those icons work locally what can i do to solve this. Thank you in anticipation of your favourable response

Related

Will I be able to use a wordpress site domain as a django website on a VPS?

I deleted all the files and folders associated with the Wordpress site I intend to write from scratch using standard HTML, JavaScript, CSS and with Django framework. My question is if I can use this domain with this newly created site in a VPS.
At first I had erased the files and folders and recreated it with the Django app right onto the Wordpress structure, and that does not seem to be working. I am most likely doing something wrong anyways, but I am after the right way of accomplishing this.
Domain names are separate from web servers (such as your VPS), CMS (e.g. WordPress) or a framework (e.g. Django). So there is no problem using that same domain name for your new website with Django.
However, you'll need to reconfigure your VPS to run Django. Better if you reinstall your VPS with Django. Follow the guide provided by your VPS to install Django properly. This includes configuring the web server (e.g. Apache or Nginx), setting up a database, and properly linking your domain to the new server.

Django Templates Not Updating with CSS Changes

I am currently working on a project using Django and Django Templates.
For this project, I had to adjust the design and tweak some of the CSS in the static files.
I had previously been running the server on a Google profile for a while.
However, after completing my changes, and running the server on that same Google profile, none of the changes I've made was displayed.
When I run the server on a guest account, change my Google profile, or run the server on Safari, the changes appear.
I'm curious to know why this is happening.
Any ideas?

HTML5 Application (Cloud Foundry) - 404 Not Found nginx

I deployed a React-Application with the Staticfile Buildpack to Cloudfoundry on the SAP Cloud Platform which has different routes (e.g."/login", etc.)
When I access the app with the provided URL (e.g. "www.exampleurl.com") and navigate through my app everything works, the different pages with different routes are working as expected.
My problem now is that, everytime I want to reload a page or if I want to access the application with an additional path attached initally e.g "www.exampleurl.com/todo-route" instead of just "www.exampleurl.com/" I get an 404 Not Found nginx error.
Is this problem related to the application router I need to configure before deploying my application or is it something different.
Unfortunately, I am not getting smarter from reading the documentation and resources on this are very rare in general.
I would appreciate some advice very much. Thank you in advance.
For people having trouble with single-page applications as well:
I found an answer already myself.
Refering to this post:
Deploy single page application Angular: 404 Not Found nginx
You need to add a "Staticfile" file in your dist or build folder with "pushstate: enabled".
You can also refer to the cloudfoundry documentation for the staticfile buildpack: https://docs.cloudfoundry.org/buildpacks/staticfile/index.html
Hope that will help some people on the way.

How to load images on Heroku (Django deployed app)

I've just recently deployed my Django application using heroku, and have an issue where the profile pictures in my blog website don't save (ends up being an image that never loads).
Is there any way I can solve this (and if so, without using Amazon S3)?
I want to avoid Amazon S3 if possible.
Is there anyway or alternatives to implement images into my Heroku website?
I've used Cloudinary for a django blog on heroku. The api allows you to upload and display images quite easily.
You will have to serve the images using static files. Also, you will need to install WhiteNoise, which will serve the static files on Heroku. For the short-term this should be fine, however, for the long term, it is recommended that you use a cloud-based service.
This link is the main guide:
https://github.com/codingforentrepreneurs/Guides/blob/master/all/Heroku_Django_Deployment_Guide.md
I would recommend going through the references also.
These would be the references:
1) http://whitenoise.evans.io/en/stable/django.html
2) https://docs.djangoproject.com/en/3.0/howto/static-files/
3) https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#std:templatetag-static
I ran into the same problem you ran into. Following the steps in the guide and references worked well for me.

How to setup Django + React on hosting?

I've done Django + React application.
I build React code using 'npm run build' and moves that files to hosting together with Python files, I've set up static files in Django app, and now when I'm going to site URL, I see that all static files are loaded. But they don't run. And when on the local environment I saw pretty JS app, now on hosting I see a white screen and when I select compiled JS files in Network tab in Developers Tools (Preview response) I read message "You need to enable JavaScript to run this app." (for CSS too).
I know that this is a noob question. But can you help me to solve this issue?
Thank you.
Check this site out https://www.techiediaries.com/create-react-app-django/
And go down "Integrating React App with Django in production"
This will show you how your app should be structured with the correct settings in your django files.