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

System Administrator ab75cd98e3 test hace 1 año
SharixAdmin ab75cd98e3 test hace 1 año
bin 02ced2b05c Added script collectstatic.sh hace 1 año
core 2bb9db9bdb Added name system to authorization page hace 1 año
design_template-backup ec445bfed1 add: ejabber conf in readme hace 1 año
media d5042624a1 add partner info tickets add hace 1 año
staticfiles 98420a2f9c first commit hace 1 año
.DS_Store 98420a2f9c first commit hace 1 año
.gitignore 7e11a2e549 Updated logo hace 1 año
README.md ec445bfed1 add: ejabber conf in readme hace 1 año
install_unix.sh 77e489d218 updated page authorization hace 1 año
install_win.bat d5042624a1 add partner info tickets add hace 1 año
manage.py 98420a2f9c first commit hace 1 año
requirements.txt e490a617d3 add jazzmin hace 1 año
sports.pgsql ec445bfed1 add: ejabber conf in readme hace 1 año
test.py ec445bfed1 add: ejabber conf in readme hace 1 año
update_unix.sh 77e489d218 updated page authorization hace 1 año
update_win.bat cac3fb6faa Update scripts hace 1 año

README.md

ShariX Open Admin

Admin system implemented as a Django application.

How install?

1) Download or clone repository

git clone http://git.sharix-app.org/ShariX_Open/sharix-open-webapp-base.git name_project

1) Set up a configuration file

#Create file config.py with this setting or rename this file to config.py

#BASE
DEBUG=True
SECRET_KEY='secret-key(absolutely any character)'
ALLOWED_HOSTS = ['127.0.0.1']
CSRF_TRUSTED_ORIGINS = []
API_URL = "127.0.0.1"
#DRIVE=2;ASSIST=1
SERVICE_ID = 1
#DATABSE
DB_NAME=None
DB_USER=None
DB_PASSWORD=None
DB_HOST=None

#GUNICORN
BIND = "127.0.0.1:8000"
WORKERS = 2
THREADS = 4

#STATIC
from pathlib import Path
import os
BASE_DIR = Path(__file__).resolve().parent.parent
STATIC_URL = '/static/'
[BASE_DIR / "SharixAdmin/static/", BASE_DIR / "tickets/static/", BASE_DIR /"design_template/static"]
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")

#EJABBER
EJ_PROTOCOL = "http"
EJ_IP = "10.0.20.9"
EJ_PORT = "5280"
EJ_URL = EJ_PROTOCOL + "://" + EJ_IP + ":" + EJ_PORT + "/" + "api/"
EJ_SERVICE = "chat.ej.sharix-app.org"
EJ_HOST = "ej.sharix-app.org"

WEBSERVICE_NAME = "open" # Service name that is used in generating ejabber rooms

3) Run a install_win.bat 4) The system will prompt you to create a superuser

#Example
7987654321
admin
pa$$w0rd
pa$$w0rd

Ready!

Server instalation

1) Download or clone repository

git clone http://git.sharix-app.org/ShariX_Open/sharix-open-webapp-base.git name_project

2) Set up a configuration file nano core/config_template.py

#Create file config.py with this setting or rename this file to config.py

#BASE
DEBUG=True
SECRET_KEY='secret-key(absolutely any character)'
ALLOWED_HOSTS = ['127.0.0.1']
CSRF_TRUSTED_ORIGINS = []

#DATABSE
DB_NAME=None
DB_USER=None
DB_PASSWORD=None
DB_HOST=None

#GUNICORN
BIND = "127.0.0.1:8000"
WORKERS = 2
THREADS = 4

#STATIC
from pathlib import Path
import os
BASE_DIR = Path(__file__).resolve().parent.parent
STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / "SharixAdmin/static/", BASE_DIR / "tickets/static/"]
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")

#EJABBER
EJ_PROTOCOL = "http"
EJ_IP = "10.0.20.9"
EJ_PORT = "5280"
EJ_URL = EJ_PROTOCOL + "://" + EJ_IP + ":" + EJ_PORT + "/" + "api/"
EJ_SERVICE = "chat.ej.sharix-app.org"
EJ_HOST = "ej.sharix-app.org"

WEBSERVICE_NAME = "open" # Service name that is used in generating ejabber rooms

3) Run a install_linux.sh 4) The system will prompt you to create a superuser

#Example
7987654321
admin
pa$$w0rd
pa$$w0rd

5) Set up the bin/webuser.sh file with valid paths

#!/bin/bash
cd /path/to/project
exec /path/to/project/env/bin/gunicorn core.wsgi:application -c core/conf_gunicorn.py

6) It remains to configure Nginx conf and start the daemon

Settings

Optional configuration params, which can be added to your project settings:


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/config.py

# ...
#API
# The URL where it is possible to access the API.
API_URL = 'http://127.0.0.1:8000'
# ...
# <module>/apps.py

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

Usage example

# <module>/<file>.py

import requests
from <module>.apps import api
from core.config 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=api.headers)

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