Comments on How to Install Django Python Framework on CentOS 8

Django is a free, open-source and high-level web framework used for developing Python Web Applications. In this tutorial, we will learn how to install Django and configure Nginx as a reverse proxy for Django on CentOS 8.

12 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Awlad

After following all steps in nginx, on chrom I typed 192.168.186.128:8000

but it gives "This site can't be reached" 192.168.186.128 refused to connect.

What am I doing wrong?

By: Marek

The same problem, guide not work!!!. on step access django application  "You can access the Django application by visiting the URL http://your-server-ip:8000. You should see the following page: " 

This site can’t be reached 207.180.221.209 refused to connect.  

By: Jake

The guide is ok. Compare the output that you got when you started Django with the one from the guide. If Django reported "Django application is now started and runs on port 8000." and you have set the correct IP as allowed host, then it must be accessible from that IP. It might be that you just tried to access it from a different IP. You can continue then with the next step to set up Nginx and when you reached the end of the guide, try to access it on the port you configured in nginx.

By: Marek

This is my mistake everything works fine, great work, thank

By: Firdous

Is it okay to place project under /opt directory?

By: Stephan

creating the django systemd service file did not work for me. After django active is failed when running systemctl status django. This is my current file: [Unit]

Description=django daemon

After=network.target

 

[Service]

User=nginx

Group=nginx

WorkingDirectory=/web/google_groceries

ExecStart=/usr/local/lib/python3.6/site-packages/gunicorn --workers 3 --bind unix:/web/google_groceries/google_groceries.sock google_groceries.wsgi:application

 

[Install]

WantedBy=multi-user.target.

 

The path for gunicorn in the article did not apply to me

By: Idoe

When I access http://your-server-ip the nginx greeting page is shown and not the Django welkome page.

My debugging: When i run /usr/local/bin/gunicorn --workers 3 --bind unix:/opt/djangoproject/djangoproject.sock djangoproject.wsgi:application the http://your-server-ip:8000 is not reachable

treminating with the error mesage ERR_CONNECTION_REFUSED

 

When I run /usr/local/bin/gunicorn --workers 3 --bind 0.0.0.0:8000:/opt/djangoproject/djangoproject.sock djangoproject.wsgi:application the page http://your-server-ip:8000 is accessible 

By: Idoe

I installed sudo yum install selinux-policy-devel and the simply ran sudo semanage permissive -a httpd_t. 

It works! 

Now to serach for some certbot tutorials.

By: Edwin

Did I do something wrong? *41 connect() to unix:/opt/djangoproject/djangoproject.sock failed (13: Permission denied) while connecting to upstream

By: Medet

Thank you! It was the most useful post in my all searched posts. After 3 days hard work it was work successfully today!

By: kuda

 wow, excellent stuff bro. God bless u man. i love this!

if i may ask, why am i not getting the server running wen i dont including the port?

it gives me the error 502 bad gateway, nginx 1.141

also how do i get to use a domain name instead of an ip address? i have a centos dns server.

 

Lastly, yes this tutorial is great n i deeply appreciate it, but is it there is if i want to host my websites n dont want to keep on running the python manage.py runserver all the time?

Excellent tutorial indeed, made everything easy.

 

one love n God bless u guys!

 

By: gianluca

I'm trying to install on fedora server 36 with user access and no root, with no success ....