SMart SCHeduling
Required software (on ubuntu's OS family):
sudo apt-get install libpq-dev python-dev postgresql postgresql-contrib python virtualenv python-virtualenv gcc
Postgres installation
- If you don't have postgres installed, complete step seven from https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn (remember to save all the credentials, they will be necessary to run the application).
Developer project installation
mkdir -p ~/dev/smash
cd ~/dev/smash
git clone ssh://git@git-r3lab-server.uni.lu:8022/piotr.atyjaszyk/scheduling-system.git
cd scheduling-system
-
virtualenv env
to create new virtualenv (contains clean python working environment) -
. env/bin/activate
(to start using virtualenv) -
pip install -r requirements.txt
to install project's dependencies - Create
local_settings.py
file in(./scheduling-system)/smash/smash
directory (see template below), and change your database connection data:
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'Paste long random string here' # Insert long random string
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
WSGI_APPLICATION = 'smash.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'smashdb', # Insert your database's name
'USER': 'postgresmashuser', # Insert your database's user
'PASSWORD': 'thePOSTGRESpassword', # Insert your user's password
'HOST': 'localhost',
'PORT': '' # '' === default one # Empty string is OK
# If to use sqlite
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
STATIC_ROOT = '/tmp/static' # Warning! `/tmp` directory can be flushed in any moment; use a persistent one; e.g. ~/tmp/static
MEDIA_ROOT = '/tmp/media' # Warning! `/tmp` directory can be flushed in any moment; use a persistent one, e.g. ~/tmp/media
- Update migration db scrpit from file structure (
./scheduling-system/smash/manage.py makemigrations
) - Create the database by applying migrations (
./scheduling-system/smash/manage.py migrate
) - Create the first, administrative, user- (
./scheduling-system/smash/manage.py createsuperuser
)
Development
- Remember, that before working you have to activate virtualenv, by:
devel@host ~/home/smash/scheduling-system $ . env/bin/activate
- In order to run development server, run:
devel@host ~/home/smash/scheduling-system/smash $ ./manage.py runserver
and go to127.0.0.1:8000
in browser - For reference of HTML tempalte, see https://almsaeedstudio.com/themes/AdminLTE/pages/widgets.html#