Skip to content
Snippets Groups Projects
user avatar
Piotr Gawron authored
9f29ecdc
History

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

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 to 127.0.0.1:8000 in browser
  • For reference of HTML tempalte, see https://almsaeedstudio.com/themes/AdminLTE/pages/widgets.html#