0

I have a django application that was tested and working fine in our UAT environment which is a centos 7 server. When the time came to migrate the same to production, I copied the files to production server which is again a centos 7 server and applied the migrations.

When I am trying to access my application through localhost it doesn't show the index page. It just gives a generic error the site can't be reached.

I removed all the .pyc files and ran compileall but nothing worked.

Any clue how to run a already functioning django app in a new server?

KChow
  • 317
  • 3
  • 15
  • 1
    How is your server configured to serve the Django site? Did you copy those configuration files over as well? Did you install and start the relevant services? – Daniel Roseman Mar 22 '19 at 14:42
  • My non prod application was accessed through nginx and gunicorn. Here I have simply copied the files and am using python dev server to test if the application is running fine. Using runserver also doesn't give me anything. – KChow Mar 22 '19 at 14:47
  • 1
    What do you mean, "doesn't give me anything"? *How* are you running it, and more importantly how are you accessing it? Obviously the dev server is not the same as nginx/gunicorn. – Daniel Roseman Mar 22 '19 at 14:48
  • I am simply running python manage.py runserver. When I try to access the url through localhost I get 'site can't be reached' error. Once this runs through runserver I will integrate nginx and gunicorn. – KChow Mar 22 '19 at 14:55
  • [`manage.py runserver` should _**never**_ be used in production](https://docs.djangoproject.com/en/2.1/ref/django-admin/#runserver). Start with `gunicorn` or `uwsgi` or some other WSGI server. There are lots of guides out there for doing this. – ChrisGPT was on strike Mar 22 '19 at 14:57
  • You are right. I will be using gunicorn and nginx and I have used the same in our UAT environment. I just wanted to test it before integrating gunicorn and nginx. Is it possible to test with runserver in centos environment. – KChow Mar 22 '19 at 15:03
  • But runserver serves on port 8000 by default, and doesn't bind to an external address. Unless you bind to 0.0.0.0 and access 8000 in your browser you won't be able to access it. – Daniel Roseman Mar 22 '19 at 15:04
  • what do you mean bind to 0.0.0.0 . I am trying to access my webpage using localhost:8000. – KChow Mar 22 '19 at 15:14

0 Answers0