Reputation: 187
I am currently using the Bitnami Django Stack tool to host one of my applications. Is it possible to host another application while my first application is still running?
Thanks.
Upvotes: 0
Views: 299
Reputation: 191
Yes, you can. You just need to create another Django project. Note that the location of the Django projects folder depends on the platform. The projects folder is located at installdir/apps/django/django_projects (on Linux and macOS) and C:\Users\USER\Bitnami DjangoStack Projects on Windows.
To create a new project you will need to:
cd installdir
./use_django
django_admin.py
to create a new project:
django-admin.py startproject <PROJECT>
manage.py
tool:
python manage.py startapp <APP>
sudo installdir/ctlscript.sh restart apache
You should now be able to see your new application at http://localhost/PROJECT/APP
Notice that, this procedure only would work if you don't have changed any of the default Bitnami configuration.
Upvotes: 2
Reputation: 3265
Of course it is possible. This depends on the way you want to "present it to the public". I'll explain you the way to do it using Apache prefixes but let me know if it is otherwise.
So, basically, when you are using a Bitnami Django Stack you have an Apache that loads mod_wsgi
which serves your python requests against your website. The way Bitnami tells Apache: "Hey, I got some Django data, please, serve it at URL/Project
" is by adding some directives indirectly to the apache main configuration file, /opt/bitnami/apache2/conf/httpd.conf
. This file includes /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf
, which includes opt/bitnami/apps/django/django_projects/Project/conf/httpd-prefix.conf
.
What you must do in order to be able to serve a second Django project at, say, URL/LawrenceRules
, is to, within /opt/bitnami/apps/django/django_projects/
, perform a copy from the sample django project like this: sudo cp -a /opt/bitnami/apps/django/django_projects/Project /opt/bitnami/apps/django/django_projects/LawrenceRules
.
Now, you will have a project named LawrenceRules. But it is not enough. You must substitute all Project
matches within the resulting LawrenceRules project with LawrenceRules
, so that all the configurations point to the right place. This can be achieved with the following one-liner:
sudo egrep -R '\/opt\/bitnami\/apps\/django\/django_projects\/Project' /opt/bitnami/apps/django/django_projects/LawrenceRules | grep -v Binary | awk '{print $1}' | cut -f1 -d":" | sort | uniq | sudo xargs sed -i 's/Project/LawrenceRules/g'
Finally, open /opt/bitnami/apps/django/django_projects/LawrenceRules/conf/httpd-app.conf
and edit the last two lines, rewriting /Project
with LawrenceRules
.
Now, you will have to tell Apache (remember that he only knows about the first project, named after Project and served at URL/Project
. Open /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf
and add the following line:
Include "/opt/bitnami/apps/django/django_projects/LawrenceRules/conf/httpd-prefix.conf"
And you are ready to go! Second project enabled. Let me know if you wish to enable different configurations. I'll be glad to help here. And I am sorry about this brick!
Upvotes: 2