Skip to content

nolsatuid/courses

Repository files navigation

Nolsatu Courses

Nolsatu course adalah platform untuk belajar pemrograman dengan materi dan modul yang disusun secara sistematis, sehingga bisa dipelajari kapanpun dimanapun.

Prerequisite

  • Python 3.6.x already installed on system or using virtualenv
  • Postgresql 9.6.x
  • wkhtmltopdf 0.12.3
  • Redis Server 3.0 or latter

Development Setup

Install dependencies

$ pip install -r requirements.txt

Create your own settings and modify as your preference

$ cp academy/local_settings.py.sample academy/local_settings.py

Configure database connection in local_settings.py with the database, database user, redis cookies domain and database password you configure in postgreSQL.

Migrate database

$ python manage.py migrate

Collect Static

$ python manage.py collectstatic

Compress Static File

$ python manage.py compress --force

Create superuser

$ python manage.py createsuperuser
Username (leave blank to use 'btech'):
Email address: contact@btech,id
Password:
Password (again):
Superuser created successfully.

Runing the service

python manage.py runserver

Then open your browser http://localhost:8000 and voila your web apps is already running !

Server Installation And Configuration

Pre-Installation

You need to install the following apps:

  • python3.6
  • Nginx
  • PostgreSQL
  • virtualenv

Application Setup

Clone the latest source code from the repository, and I assume you put it to /var/www/html/

$ cd /var/www/html/
$ git clone {repository}
$ cd academy

Then create virtualenv with python3

$ virtualenv --python=python3.6
$ source/env/bin/activate
$ pip install -r requirements.txt
$ pip install gunicorn

Then create a configuration file, just copy from sample file and modify as your preference

$ cp nolsatu_courses/local_settings.py.sample nolsatu_courses/local_settings.py

Then run the database migration

$ python manage.py migrate

Then create first superuser

$ python manage.py createsuperuser
Username (leave blank to use 'btech'):
Email address:
Password:
Password (again):
Superuser created successfully.

Then generate static files

$ python manage.py collectstatic

Create logs directory

$ mkdir logs

Sysadmin daily operation

  • Deploy the latest update
$ source env/bin/activate
$ git pull origin master
$ python manage.py migrate
$ python manage.py collectstatic
$ update_setting.sh dev/prod