-
Notifications
You must be signed in to change notification settings - Fork 35
Configuration
The main file configuration for iSkyIMS is 'settings.py', which contains information about the database, applications, middleware, media and static folders, etc, that are needed it to run iSkyLIMS.
We provide a functional configuration, but you can tune it to fix your system by editing the file:
vim /srv/iSkyLIMS/iSkyLIMS/settings.py
As you can see when scrolling down you need to set:
- Secret key that you save before
- Password for django user in mySQL
- Change Time zone
- Email configuration, including the host name, user from the email will send and password
Look for "SECRET_KEY" and update it with the value you note write down before
Check "ALLOWED_HOSTS" variable to include the IP addresses/DNS name from which access if necessary.
ALLOWED_HOSTS = ['localhost','127.0.0.1', '<your_server_name/your_server_IP_address>']
iSkyLIMS was configured to use mySQL as database. Other database are allowed by changing the "ENGINE" line to use your database engine. For correct setting values check the django documentation.
NOTE: Specify the 'HOST' name in case your database is not located on the same server. The database configuration should be like this:
DATABASES = {
‘default’:{
‘ENGINE’:’django.db.backends.mysql’,
‘HOST’: ‘DB_SERVER_IP’,
‘USER’: ‘your_database_user’,
‘PASSWORD’:’<your_user_password>’,
‘PORT’:’3306’,
‘NAME’: ‘iSkyLIMS’,
}
}
iSkyLIMS uses a Django-crontab module for scheduling jobs.
Two crontabs are configured in settings.py file for this purpose
# Crontab settings
CRONJOBS = [
('*/30 * * * *', 'iSkyLIMS_wetlab.cron.looking_for_new_runs', '>>' + LOG_CRONTAB_FILE),
('0 0 * * FRI', 'iSkyLIMS_wetlab.cron.delete_invalid_run', '>>' + LOG_CLEAN_FILE)
]
-
The first one, that is executed every 30 minutes, will check new runs.
-
The second, executed each Friday at 00:00, will clean up the uncompleted runs.
Note that schedule jobs will start by running the following commands:
sudo su django
cd /srv/iSkyLIMS
source virtualenv/bin/activate
./manage.py crontab add
# logout django user
exit
NOTE: Please be aware that crontab **MUST ** be executed on "django" user. If this is not possible on your system it is mandatory that the user has write access to iSkyLIMS folders.
At this point it could be nice to verify that iSkyLIMS works fine before moving forward.
We are going to check the database connection:
# Remember to replace <port_number> with one of your free ports.
python manage.py runserver 0:<port_number>
The following message should appear on the terminal screen:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
You have 29 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, django_comments, sessions, sites, tagging, zinnia.
Run 'python manage.py migrate' to apply them.
April 02, 2019 - 21:21:31
Django version 2.2, using settings 'iSkyLIMS.settings'
Starting development server at http://0:8000/
Quit the server with CONTROL-C.
Type CONTROL-C to quit the server to return to shell prompt
In the previous step when checking the configuration, you get the message that some migrations were not applied. Now is the time to installed.
Execute the following commands (inside the virtual environment) to create the database structure.
python manage.py migrate
python manage.py makemigrations django_utils iSkyLIMS_wetlab iSkyLIMS_drylab
python manage.py migrate
# Update tables for hendling errors and states for wetlab
python manage.py loaddata conf/dump_errors.json
python manage.py loaddata conf/dump_runstates.json
# deactivate the virtual environment
deactivate
Check that no errors are returned during the command execution. (Some known issues are addressed in Known issues)
At this point the database structure is done on your system.
Enter to the mySQL prompt
mysql -u django -p
From the mySQL prompt, update table ‘django_site’ of database ‘iSkyLIMS’ as follows:
use iSkyLIMS;
UPDATE django_site SET domain="<your_domain>", name="your_server_name" WHERE id=1;
exit;
And just after from the command line:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
If you don't have access to /usr/share/zoneinfo in your current computer (I step into some problem using a container). You can copy to your computer the zoneinfo folder from any other place and use it to populate your database. It is just a folder with a bunch of files with time info.
Check that no errors are returned during command execution.
At this point you have in your system the necessary software files and database configuration to start iSkyLIMS running the django application server.
Type the following commands
cd /srv/iSkyLIMS
source virtualenv/bin/activate
python manage.py runserver 0:8000
Open the web browser and type http://localhost:8000/
.
You will get the iSkyLIMS welcome page