- Create a
Python/uWSGI
application via the Control Panel (Opalstack doc). - Execute
app-template-py APP_NAME [PY_VERSION]
(doc). - Copy your application files in the
app
directory. - Modify
uwsgi.ini
if/as needed. - Start the application:
app-control APP_NAME start
.
See app-control
.
app
: Your application.config
wsgi.py
: WSGI config for your application (used in/uwsgi.ini
, cf. below).
venv
: Python 3 virtual environment (Python doc)tmp
: Temporary files used by your applicationuwsgi.pid
: PID file
opalstack-requirements.txt
: pip requirements related to the Opalstack app.uwsgi.ini
: uWSGI configuration (uWSGI options).
To create a Django application, you can start with the following…
(replace APP_NAME
, MY_PROJECT
, and your-domain.com
with your values)
cd $HOME/apps/APP_NAME/
. venv/bin/activate
pip install django
cd tmp
django-admin startproject MY_PROJECT
mv MY_PROJECT/* ../app/
rmdir MY_PROJECT
cd ..
sed -i "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = ['your-domain.com']/" app/MY_PROJECT/settings.py
sed -i "/DATABASES =/, /^}/ s/^/# /" app/MY_PROJECT/settings.py
sed -i "s#config/wsgi.\py#MY_PROJECT/wsgi.py#g" uwsgi.ini
app-control APP_NAME restart
# Fine-tuning ;-)
cd venv/bin/
rm django-admin.py
ln -s ../../app/manage.py
cd ../..
And you should see the default "The install worked successfully! Congratulations!" page on http://your-domain.com/