0

I want to serve Django application at http://SERVER-IP/ OR a domain (www.example.com) instead of http://SERVER-IP/Project (www.example.com/Project) using BITNAMI Django Stack(v4.2).

I followed the documentation here for creating new application which is working perfect but I didn't find the way how to configure Django application at http://SERVER-IP/.

OS Details:

PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian

I had tried:

  1. Move application files form ~/apps/django/django_projects/PROJECT/ to ~/apps/django/django_projects/
  2. Updated all path in thses conf files:
    • httpd-prefix.conf
    • httpd-app.conf
    • PROJECT/wsgi.py
  3. Restart the Apache server.

But unfortunately, still I'm getting the apache homepage at http://SERVER-IP/ instead of Django application homepage. One more thing Django application still accessible at http://SERVER-IP/Project successfully.

Note: I need both services is running php and django.

PHP demo app I've placed in htdocs/demo/index.php I want also this approachable form URL http://SERVER-IP/hello/index.php.

Someone, please guide me!!! How to do that?

Asif Raza
  • 103
  • 4

2 Answers2

4

You can use the bnconfig tool to move the app to root.

/opt/bitnami/apps/django/bnconfig --appurl /

You can find more information about the bnconfig tool here:

https://docs.bitnami.com/aws/components/bnconfig/

2

In order to change the URL for your Django project to "/", you need to modify this file (supposing that the project you want to move to "/" is "Project"):

INSTALLDIR/apps/django/django_projects/Project/conf/httpd-app.conf

Inside the file, change these lines:

Alias /Project/static "INSTALLDIR/..."
WSGIScriptAlias /Project 'INSTALLDIR/...'

To this:

Alias /static "INSTALLDIR/..."
WSGIScriptAlias / 'INSTALLDIR/...'

And restart Apache after that:

sudo INSTALLDIR/ctlscript.sh restart

Please refer Bitnami Django For AWS Cloud And How can change the default URL

sanjayparmar
  • 623
  • 8
  • 18
  • Thanks it's works for python, But now how can i access the php app. URL like `SERVER-IP/hello/index.php` I've demo folder in htdoc. – Asif Raza Sep 05 '18 at 15:00
  • 1
    As per community, can't run stack that includes PHP and Python at the same time. check this one - https://community.bitnami.com/t/php-and-python-at-the-same-time/43943/2 – sanjayparmar Sep 06 '18 at 10:47
  • 1
    helpful for you - https://community.bitnami.com/t/how-do-i-add-python-to-the-bitnami-lamp-stack/40271 – sanjayparmar Sep 06 '18 at 10:48