Essentially,
I am doing some of the development for my Django app straight on my shared server rather than on a local machine (I know that initially is the problem) however regardless, I would like to know if there is a way to restart the apache server on my shared hosted server (Bluehost) for when I modify any of the python files.
I'm not sure how the Django framework is setup, maybe restarting the webserver is not needed?
THanks!
How is the apache configured to run python codes? are you using fcgi, wsgi or something else?
What i do is, i use a fcgi process and restart fcgi process without the need to restart the webserver. In my case web server is nginx but it should be same in apache if you are using fcgi.
Related
I created a website that uses vuejs as the frontend and django as the backend with another service running behind everything that im making api calls to.
So django is setup in a way to look at the dist folder of Vuejs and serve it if you run manage.py runserver. but the problem is that my service that I created is
is also in python and it needs to run in a virtualenv in order to work (It uses tensorflow 1.15.2 and this can only run in a contained environment)
I'm sitting here and wondering how I can deploy the django application and keep the virtualenv active and Im coming up with nothing, I've tried doing some research on this but everything I found was not relevant to my problem. I've deployed it and when I close the ssh connection the virtualenv stops.
If there is anyone that can enlighten my ways I would appreciate it.
i think you need to nginx: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
if you are search for keep states just in terminal i suggest tmux https://github.com/tmux/tmux/wiki
You can use uWSGI and nginx to deploy Django apps on server. Here's helpful articles:
https://www.digitalocean.com/community/tutorials/how-to-set-up-uwsgi-and-nginx-to-serve-python-apps-on-centos-7
https://www.digitalocean.com/community/tutorials/how-to-set-up-uwsgi-and-nginx-to-serve-python-apps-on-centos-7
Django official docs also has a page about it: https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/uwsgi/
There are articles from developers so you can refer them in case you get stuck anywhere:
https://www.freecodecamp.org/news/django-uwsgi-nginx-postgresql-setup-on-aws-ec2-ubuntu16-04-with-python-3-6-6c58698ae9d3/
https://medium.com/#biswashirok/deploying-django-python-3-6-to-digital-ocean-with-uwsgi-nginx-ubuntu-18-04-3f8c2731ade1
I have made a Django employee portal which will be accessed by LAN only.
It works when another employee opens it by typing the IP address of the server on their web browser.
However I don't have much experience with Django and I think that this is not the proper way to do so. I run my server using python manage.py runserver and use sqlite3 as database.
Is this the correct way to do so? How should I deploy my portal.
I am very new to Django and would appreciate some help.
I am using a windows machine and I used pycharm to make my project.
And also I need to know how can I have the server running even when I close pycharm, as ctrl-C or closing pycharm breaks the server
The simplest way to allow everyone on your network to access your Django webserver is to do python manage.py runserver 0.0.0.0:8000
This allows anyone on the network to access it by using your IP address (or computer name) and the port 8000. (so something like 192.168.1.2:8000)
This of course isn't really nice specially if you intent to use this as a production environment. panchicore's answer should help you setup a good production environment.
Setting up Django and your web server with uWSGI and nginx
There is not an official way to do it, what I do effectively, intranet solutions as well, is with nginx and uWSGI (on ubuntu).
Serving with Windows? perhaps: https://www.toptal.com/django/installing-django-on-iis-a-step-by-step-tutorial is a proper way to do so.
I think for ip address issue you can use host names
https://wesbos.com/localhost-mobile-device-testing/
and for running server in background you can use gunicorn with supervisor check this out https://www.agiliq.com/blog/2014/05/supervisor-with-django-and-gunicorn/
I am learning python and Django now. I have a question related to deploying Django project on windows 7. I know how to start the test server in django and see the project. But I have to do start the server manually every time I restart the PC. Also I have to keep the terminal window open.
Consider the below scenario for php projects.
We copy and paste the php files in htdocs or www folder in apache server and access them using the respected url. Web Server is running in the background. We dont have to start the server on windows restart.
Is something similar possible with Django on apache or any other server?
If yes, how should I go about it?
Thanks in advance.
For anyone stumbling around for an answer to a similar problem with deploying Django on a Windows server, here is a guide
Deploy Django with Apache and mod_wsgi on Windows Server 2019
To have Apache24 service automatically run on startup, make the changes in Windows Services dialog.
Maybe anybody know easy and work solution for deploying django site on Windows machine with Nginx reverse proxy server? I can't find WSGI module, that have support in Windows.
I'm working on a Django webapp that's running under nginx and uWSGI. When I deploy new Django code (e.g., settings.py), do I need to restart uWSGI? If so, why?
Background: I had a scenario where I updated settings.py and some other code and deployed it. I did not see the changes in the webapp behavior until I restarted uWSGI.
Yes, you need to restart the uWSGI process.
Python keeps the compiled code in memory so it won't get re-read until the process restarts. The django development server (manage.py runserver) actively monitors files for changes, but that won't happen by default with other servers. If you want to enable automatic reloading in uWSGI, the touch-reload and py-auto-reload uWSGI arguments might help.