@dcd Thanks. Answering here is more appropriate 😉
app-template-py script works great - thanks!! Looks like it's only configured for python template though -- messes with the django app template (removes uwsgi, start, stop, etc.) Thanks a ton for coding this up -- huge time saver.
app-template-py
moves all existing files into a sub-directory (mv * .* .original-files
) and copies all files from my template.
Opalstack's installer for Django apps just create a base project using django-admin startproject myproject
… which IMHO is a bit useless so I used the same for both Python/uWSGI
and Django
apps.
I added (here) the following to explain how to create a default Django app.
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/