pl  |  en

Django

Also read the Platform changes (MT 1.0 vs 2.0) article that contains the information unrelated to the specific type of an application.

virtualenv

The environmental configuration on MT 1.0 was the matter for a client, and he only had to indicate the application catalogue. There were many different options to configurate the environment. Virtualenv wasn’t the standard feature and all the modules were being kept in the same catalogue/.

At the present time it is the panel that sets up the application and forces you to use virtualenv as a good practice while maintaining the application. After you log in to the shell, workon command will show the available environments and workon environment.name command will switch you to corresponding environmend and will move you to the application catalogue. You install the modules with the pip command.

gunicorn

All the applications are launched with gunicorn. At this moment, there is no possibility to set a number of the application processes through the panel. Although, if necessary, we will implement such a tool. Please send your submissions to admin@megiteam.com.

The number of processes can be increased through the gunicorn built-in mechanisms.

kill -SIGTTIN PID_mastera

Will work until the application is restarted.

Your own DJANGO_SETTINGS_MODULE

By default, gunicorn is looking for the settings.py file in the application catalogue. You can add your own DJANGO_SETTINGS_MODULE in the .environment file in the application catalogue.

DJANGO_SETTINGS_MODULE=my.settings

Environment variables

You can set up any environment variable in the .environment file in the application catalogue. These settings are being loaded when the application starts, yet, they’re not being loaded in the shell.

Static files

The static files should be defined by the WWW server (in MT 2.0 it’s Nginx) not by the application. Our configuration assumes that the files in the static catalogue in the project catalogue (the exact path shows up when you set up a Django application) and are being served by the /static/ URL. You’re free to set any catalogue/any URL you want by adding the application in the panel at website.megiteam.com/URL.

Database configuration

The application installed through the panel (adding an application with the “create on the server” option checked) has a automatically configured database. The configuration is done by the environment. In the settings.py file there is a piece of our code that is loading the access data. You can keep the settings.py file in repo thanks to this.

You can also configure the database normally. In that case, you have to remove our code from settings.py.

Git repository

When you set up the application through the panel, also a git repository will be automatically created. The push for this repo will cause that the application catalogue will be updatet and the application will be restarted.

Supported versions

You can set up an application based on Django 1.5/1.6 and on Python 2.7/3.3. You can install any Django version through the shell. The easiest way to do this is to use the installator located in the panel. Then you should remove installed modules from virtualenv and install desired version. You will also have to remove the application skeleton that was created by us and and create the same one but this time you will be using django-admin for your own Django version.