buy
How to setup Python (Django) with Application Manager

Requirements

Install python package as per version required.

In case Python is not installed please ask your server admin to install it from  Webuzo Admin Panel > Apps > Install App

Clone the python project

Go to user home directory where you have to clone the repository. You can clone the repository from the below command  as a user.

git clone https://github.com/90x-Development/simple-django-page

Note : You can also clone the repository from  Webuzo Enduser Panel > Server Utilities > Git TM Version Control

Setup Python (Django) application

To add python application go to Webuzo Enduser Panel > Applications > Add Applications

Note : Before adding the application change the port in your project as given in "Add application" wizard.

For example in this application add following lines in manage.py file inside main function and change the port as given.

from django.core.management.commands.runserver import Command as runserver

runserver.default_port = "30001"

The manage.py file will look as follows:

#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():

    # Override default port for `runserver` command
    from django.core.management.commands.runserver import Command as runserver
    runserver.default_port = "30000"
    
    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)


if __name__ == '__main__':
    main()

Also allow the application domain in "simple-django-page/myproject/settings.py" file.

For example add application domain in as:

ALLOWED_HOSTS = ['127.0.0.1:30000','localhost','127.0.0.1','your_domain_name.com']

Fill the required fields, select python from "Application type" drop down and save it.

Enter the start command "/usr/local/apps/python3/bin/python3 manage.py runserver" .

image

After saving it will be show in "List Applications" wizard.

image

After the adding application check the domain in browser

image
image
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list