Loading a Python application for the first time. Urls urls not working

This is my first time trying to get my Django app online, but I have a problem with URls.

Working local url of my application

  • http://localhost:8000/surveythree/

    - Works as expected.

However, when I upload my project to my hosting account, I cannot find the corresponding page using the shortened URL provided by the URLconf, in which case it must be / surveythree /

url(r'^surveythree/$', SurveyWizard.as_view([SurveyForm1, SurveyForm2, SurveyForm3, SurveyForm4, SurveyForm5])),   


I can find the page if I use the full path to the file.


I thought the advantage of URLconf is to shorten the url to something like one of the following

Is there something simple that I am missing here? If anyone could tell me that the shortened url should be based on the above, that would be great. I try several times with multiple combinations, but I don't know if I'm going in circles or if I'm doing it wrong.

Thanks in advance.


source to share

2 answers

It doesn't look like you've actually deployed your site with the proper server. You can't just upload files to any web server and wait for it to run: you need to set up a wsgi server and connect it to your application.

The documentation is here , but honestly I'd be amazed if your college server supported it at all, if all you have is Public Folder. You can get it to work with FastCGI, but I won't hope for much.

(And even if you say navigating to that long URL "works", I would ensure that whatever you see is the original HTML template. By no means will any real dynamic functionality work. see if you actually tried submitting the form at that url.)



Deploying Django apps is much more complicated. To work in a more "production" environment, you need to configure:

  • virtualenv to support pip modules that your application requires separately from the global environment.
  • nginx to host static files (they can be copied to the folder with ./manage.py collectstatic

  • WSGI Server: uWSGI or Gunicorn are both good options.
  • supervisor : to start and restart WSGI and any other applications (like celery ) in the background

This is very helpful to get started, so it's good to follow the tutorial and use ready-to-use config snippets .



All Articles