Базовое веб-приложения сервиса, к которому подключаются остальные модули.

kateshev14 62a1c3c224 Merge branch 'unstable' of https://git.sharix-app.org/ekaterina_shevchenko/sharix-guide-webapp-base into unstable 5 luni în urmă
SharixAdmin 16f0bf5f4a made changes in whole project 1 5 luni în urmă
bin b2708fa2f6 Review of previous commits about the configuration file on installation 9 luni în urmă
core 303d788c0d Edit for new name of metaservicesynced to dbsyne 10 luni în urmă
.gitattributes b32fae4d7a Added a new project configuration method 1 an în urmă
.gitignore 303d788c0d Edit for new name of metaservicesynced to dbsyne 10 luni în urmă
README.md 38bb68d8d3 Обновить 'README.md' 6 luni în urmă
license-eng.md 95efa4ffb8 Added licenses 1 an în urmă
license-ru.md 95efa4ffb8 Added licenses 1 an în urmă
manage.py 98420a2f9c first commit 1 an în urmă
requirements.txt 0425c5e542 Necessary corrections have been made for correct operation with the sharix-open-user-model 11 luni în urmă

README.md

ShariX Guide Webapp Base

The base Django project of a service web application to which other modules are connected.

Installation

Download or clone repository. For the initial configuration, run bin/install.sh.

Configuration

For basic project configuration when deploying, use the core/settings_vars.py. This file is automatically created during the installation script execution, in case this file has not been created yet. It is a copy of core/_settings_vars.py and contains some default settings that allow the project to run locally and is more suitable for development.

Be careful when adding new settings during development and remember to add them to core/_settings_vars.py, as core/settings_vars.py is ignored by Git for security reasons.

You can also change the settings in bin/install.cfg. This file contains the links to repositories required for the project to work.

Utilities

Utilities provides important functionality to web-application, so it is important to know and understand how they work. They are stored in core/utils.

AuthAPI

That class provides the ability to authenticate an application account through the API and store these authentication tokens.

Modules using the API should log in ShariX system using this class.

Setting up

# core/settings_vars.py

API_URL = 'http://127.0.0.1:8000'
# <module>/apps.py

from core.utils.AuthAPI import AuthAPI
auth_api = AuthAPI("<module_login>", "<module_password>")

Usage example

# <module>/<file>.py

import requests
from <module>.apps import auth_api 
from core.settings import API_URL

# You can use api.headers to get the corret authorization header in your requests.
requests.get(f"{API_URL}/tickets/api/tickets/", headers=auth_api.headers)

# Or you can get just token.
print(auth_api.token)

Launch

To start the web application, run bin/start.sh.