Django Framework
Django is a highly popular, full-stack, open-sourced framework of Python that includes all Python features by default. This high-level framework handles much of the intricacies of web development in a built-in manner, and allows developers to focus on the logic of their apps. Django also offers inherent support for commonly-used database systems and ORM support to map objects to tables, which facilitates easy data migration.
This example illustrates the steps to build a simple Python app with the Django framework. This application will then be bundled and associated with an AppSail service, and deployed to the console.
-
Create a new folder in your local system for the Django app.
-
Navigate to the directory from your terminal and execute the following command to install Django:
copypython3 -m pip install django -t .
- Create a Django project by executing the following command.
copypython3 -m django startproject mysite
-
You can now initialize an AppSail service in the same directory from the CLI or add it in an existing project directory. The app’s source must be your application’s directory. Provide the following value while initializing the app service:
Stack: Python_3_9
-
Ensure all the Python application files along with the django modules are present in the build directory you specify during initialization. Catalyst will automatically ZIP your app files during deployment to the remote console.
-
Deploy the app service to the console.
-
You can then configure the startup command given below from the console:
copysh -c 'python3 -u mysite/manage.py runserver 0.0.0.0:${X_ZOHO_CATALYST_LISTEN_PORT}'
You can also configure this in the app-config.json file before deploying.
Access the deployed app service from its endpoint URL.
Last Updated 2023-12-14 16:25:23 +0530 +0530
Yes
No
Send your feedback to us