-
Notifications
You must be signed in to change notification settings - Fork 0
cfauchard/hermesgui
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
================================================================================ 1. Initial installation 1.1 Dependancies 1.1.1 Create a python venv whith following dependancies Django (1.10.1) mod-wsgi (4.5.7) pip (8.1.2) setuptools (20.10.1) mod-wsgi is only needed for apache installation (production platform) 1.2 Configure Environment 1.2.1 By makefile <vi makefile> ROOT=<root install path directory> </vi> <vi django/hermesgui/settings.py> STATIC_ROOT = '<root install path directory>/www/static' </vi> <sh>make</sh> 1.2.2 Manually generate static files For platforms without make and apache httpd installed. <sh> mkdir -p www/static cd django python manage.py collectstatic --no-input </sh> 1.3 Database tables generation <sh> cd django python manage.py migrate </sh> 1.4 Super user create <sh> cd django python manage.py createsuperuser </sh> ================================================================================ 2. Configuration 2.1 Localization <vi django/settings.py> LANGUAGE_CODE = 'fr' TIME_ZONE = 'Europe/Paris' </vi> ================================================================================ 3. Administration 3.1 Development server <sh> cd django python manage.py runserver 0.0.0.0:8000 </sh> ================================================================================ 4. Models 4.1 Model definition 4.1.1 Model definition example <vi django/<application/models.py> ... class Connection(models.Model): GET = 'get' PUT = 'put' COMMANDS = ( (GET, 'GET'), (PUT, 'PUT'), ) SFTP = 'sftp' FTP = 'ftp' PROTOCOLS = ( (SFTP, 'SFTP'), (FTP, 'FTP'), ) name = models.CharField(max_length=80, blank=False, default="", primary_key=True, unique=True) host = models.CharField(max_length=80, blank=False, default="localhost") protocol = models.CharField( max_length=4, choices=PROTOCOLS, default=SFTP, ) user = models.CharField(max_length=30, blank=False, default="") password = models.CharField(max_length=30, default="", blank=True) private_key = models.CharField(max_length=80, blank=True, default="") deleteflag = models.BooleanField(default=None) activation = models.BooleanField(default=None) command = models.CharField( max_length=3, choices=COMMANDS, default=GET, ) excluderegex = models.CharField(max_length=30, default="", blank=True) includeregex = models.CharField(max_length=30, default="", blank=True) localdir = models.CharField(max_length=80, blank=False, default="") statuslogdir = models.CharField(max_length=80, blank=True, default="") backupdir = models.CharField(max_length=80, blank=True, default="") remotedir = models.CharField(max_length=80, blank=True, default="") logfile = models.CharField(max_length=80, blank=True, default="") def __str__(self): return self.name </vi> 4.2 Application declaration <vi django/settings.py> INSTALLED_APPS = [ 'connection_admin.apps.ConnectionAdminConfig', ... ] </vi> update database schema <sh> python manage.py makemigrations python manage.py migrate </sh> 4.2 Model admin add to administration interface: <vi django/connection/admin.py> ... from .models import Connection admin.site.register(Connection) </vi> ================================================================================ 5. Views 5.1 Definition <vi django/connection/views.py> def detail(request, connection_name): return HttpResponse("You're looking at connection %s." % connection_name) </vi> 5.2 Add corresponding url <vi django/connection/urls.py> url(r'^(?P<question_id>[0-9]+)/$', views.detail, name='detail'), </vi>
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Packages 0
No packages published