Django Apache Hello World

Is there a Hello World tutorial for getting a minimal Django project working with Apache?

Alternatively, someone can tell me where I went astray. I went through Django tutorials and everything seems to work as expected, but they do not cover how to actually deploy the example using apache server. I found their documentation on how to get Django working with Apache , but I had no luck with it. I'm on Ubuntu. I did apt-get install libapache2-mod-wsgiand then followed the instructions on the second link above.

My / etc / apache2 / httpd.conf is single line (is this normal?)

WSGIScriptAlias / /home/john/programming/djangotutorial1/mysite/apache/django.wsgi

And I created a new file in / home / john / programming / djangotutorial 1 / mysite / apache / django.wsgi, which looks like this:

import os
import sys

path = '/home/john/programming/djangotutorial1'
if path not in sys.path:
        sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Django, .

mywebsite.com, 500 .

?

+3
1

500, , . , settings.py Apache. , 500, , .

, Hello World, . Apache, .

+2

Source: https://habr.com/ru/post/1779906/


All Articles