Python Django App Design change on deploy to server - python

I recently uploaded my Django App to the server (Digital Ocean). The functionality is okay as in my local project on my computer, but the design (css style) of the Admin Interface has changed drastically in a lot of elements of the change_list and change_form templates. I‘ve checked and made sure that the templates of my local Django and Suit files are the same as they of the server, but it is still not the same design.
Does anyone has experience with that?

In deployment server just collect your static files from static folder by running command python manage.py collectstatic which will create a staticfiles folder in your Main project app in the project directory. May be this will help. Try it out.

Related

Where does the fcgi.py file go in the 'Django on Bluehost' WSGI solution?

In the post [1]How to deploy Django app on Bluehost using WSGI?
it mentions the .htaccess, django.fcgi, and fcgi.py files. Where is the fcgi.py file to be located? Does it go in the django project or app folder, or in the public_html folder? The latter would seem like a security issue, but as I'm having trouble getting any solution to work for Django on Bluehost (and am running out of patience) I thought I'd dig a little deeper.

how can i convert django app to desktop app

I have a Django app up and running on DigitalOcean with Nginx and PostgreSQL. But some clients want an offline version of the app so that their data remains on their systems and they don't have to connect to the internet. One solution is to write the whole app from scratch but that would take time and cost.
I was thinking of a solution where I can convert the Django app into a desktop app with minimal changes i.e. replace CDNs with files and remove functionality that requires internet. But I don't know how can I do this.
I was thinking of electron, i,e, elctron will spawn a child process which will start django's server and then the electron will load 127.0.0.1:8000 in a webview.
But how can I package this app into an executable because it would need python installed and configured on the user's system. Or does python itself has any library that can convert the Django app into a desktop app?
Below is the file structure of my Django project
project_folder/
app_1/
app_2/
app_3/
configurations/
templates/
__init__.py
asgi.py
settings.py
urls.py
wsgi.py
media/
staticfiles/
manage.py
Any help would be appreciated.

Restarting Python to show changes

I am new to the python script. How do you restart a python script with Django through SSH?
I believe that you project is django based.
Django framework has a project directory, where static files are initially placed. And when you run your project for development purposes, django takes all static from the project static directory.
But for the production django deployment usually get runned command manage.py collectstatic to copy all static into another place. And sometimes there are another command - compress. To compress that static.
This is done to make webserver (apache or ngingx) respond static files without asking django process requests like "five me that static file" and gives ability to cache static files. And it speed-up all work.
So, if you serveer is setted up to take static files from static dir (looks like DOMAIN/public/static/main/ is the static dir) it will have no idea about changes in the project dir (looks like DOMAIN/project_book/main/static/main/ is a project dir).
But I agree with #Sause, looks like you have to be very carefull and have exact understanding of what you're doing with killing any process on the production server.
I think it could be useful for you to read Django documentation about static files too. https://docs.djangoproject.com/en/1.9/howto/static-files/
running pkill python in the ssh works.

Hosting Django and Path to Project Directory

I am using a digital ocean virtual server to host a django web app. when you create the droplet, it creates a default app in the directory /home/django/django_project/django. However seeing as this isn't the app I want to host, I put my application files into the directory /home/myproject/myapp and updated the gunicorn and nginx configs to point there. However once updating the urls for this app, I am trying to see it online and noticed that the 404 looked like this:
which states that the URLconf is defined in django_project.urls which I had since deleted out of that 'home/django directory. I have reloaded and restarted gunicorn and nginx in an attempt to get django to realize that the project django_project doesn’t exist any more, but no luck. Has anyone run into this before or have any suggestions as to what I should try next?

What are the problems with loading CSS and JS from Django to IIS7?

I successfully deployed my Django site to IIS7 but I still have problems about how to configure IIS to serve the static files. I tried many many things from the internet but nothing seems to work. Everything is working fine on Django server (manage.py runserver) and with debug = True, but as soon as I turn off debug (debug = False) and open it on IIS, the bootstrap css and js are not loaded.
Do you have any ideas about why I'm experiencing this behavior? Perhaps you could point me to a step-by-step guide to help me?
Right click on your website in IIS7 manager and
add a virtual directory
name it with the same name of your folder you want IIS to handle. lets say static
add the path to your real static folder in your application mine was in myproject/static then ok
and here you go :)
If you are using django >= 1.3 and following the doc you are probably using the 'staticfiles' app.
First, you must configure your II7 to serve static files from the chosen path, by default URL: /static/ and PATH /staticfiles/ (I have no experience with II7 but the conf should be straightforward)
Then run ./manage.py collectstatic to move the static files into the correct path
and you should be done...
More info on production settings here.
You also need to insert a web.config file into the static directory for IIS to serve the files.
See: Django Static Files - 404

Categories