Kako namestim DJANGO framework (Django gostovanje)?
Upoštevajte, da ne uporabljamo wsgi, temveč passenger + Apache.
1. Python aplikacija
Ustvarite oz. kreirajte novo Python aplikacijo (endpoint-file). Wsgi bo videti zelo podobno:
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
message = 'It works!\n'
version = 'Python %s\n' % sys.version.split()[0]
response = '\n'.join([message, version])
return [response.encode()]
import sys
sys.path.insert(0, os.path.dirname(__file__))
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
message = 'It works!\n'
version = 'Python %s\n' % sys.version.split()[0]
response = '\n'.join([message, version])
return [response.encode()]
2. Django framework
Po uspešno ustvarjeni Python aplikaciji in s tem tudi aktiviranem navideznem okolju, vnesite ukaz:
Enter to the virtual environment.
To enter to virtual environment, run the command: source … && cd ….
To enter to virtual environment, run the command: source … && cd ….
pip install Django
Več o Python (dostop do spletne strani).