Я настраиваю основанное на Python веб-приложение на cPanel с помощью встроенного модуля python.Когда я открываю указанный URL в своем браузере, единственным результатом является значение по умолчанию для файла passenger_wsgi.py
, даже когда я изменяю содержимое этого файла:
It works!
Python 3.7.2
Я пытался решить эту проблему с помощьюприведенный ниже код из DreamHost , но, как я уже сказал, в данном результате passenger_wsgi.py
файла нет изменений:
import sys, os
cwd = os.getcwd()
myapp_directory = cwd + '/myapp'
sys.path.insert(0,myapp_directory)
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = "myapp.settings"
from paste.exceptions.errormiddleware import ErrorMiddleware
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
# To cut django out of the loop, comment the above application = ... line ,
# and remove "test" from the below function definition.
def testapplication(environ, start_response):
status = '200 OK'
output = 'Hello World! Running Python version ' + sys.version + '\n\n'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
# to test paste's error catching prowess, uncomment the following line
# while this function is the "application"
#raise("error")
start_response(status, response_headers)
return [output]
application = ErrorMiddleware(application, debug=True)
Как я могу настроить свой проект из public
папка из указанной директории?
Мой проект - простой проект на чистом Python.