*`create user kape password 'kape';` to create user.
*`create database kape;` to create database.
* if you want to create another database user, please update the setting file `kape/settings.py`
*`python manage.py migrate` To migrate all the database
## Run Development Mode App
*`npm run webpack` to run webpack server. (if you don't want live update run `npm run build`, if you want the uglified+zipped+production ready version run `npm run build-production`)
* on a different terminal window, run `python manage.py runserver` to run API server
### Now go to localhost:8000 and you'll see the App running!
## Run Unit Test
* Frontend test, run `npm run webpack`
* Backend test, run `python manage.py test`
# Kanal Akses Pendaftaran KP Elektronik _(kape)_
> Internship matchmaking platform for students and companies.
## Table of Contents
-[Install](#install)
-[Running Development Mode (Classic)](#running-development-mode-classic)
-[Running Development Mode (Containerised)](#running-development-mode-containerised)
-[License](#license)
## Install
This project uses Python 2 and Node.js v4 for building the backend and frontend,
respectively. The backend uses Django Framework and PostgreSQL database, while
the frontend is developed using React. You need to install the required
dependencies prior to building and contributing to the project.
-[Node.js v4.9.1](https://nodejs.org/en/download/releases/) and `npm` package
manager.
> Note: We recommend `nvm` (Node Version Manager) for installing Node.js. You
> can find `nvm` for your OS at the following links:
> - [nvm for macOS or GNU/Linux-based OS](https://github.com/creationix/nvm)
> - [nvm for Windows](https://github.com/coreybutler/nvm-windows)
>
> Once `nvm` has been installed, install Node.js and activate it by executing
> `nvm install 4.9.1` followed by `nvm activate 4.9.1`.
-[Python 2.7.16](https://www.python.org/downloads/release/) and `pip` package
manager.
> Note: We recommend using _virtual environment_ to isolate project-specific
> Python packages from system-level packages. You can install and use
> [`virtualenv`](https://virtualenv.pypa.io/en/stable/) package to create the
> virtual environment for this project.
-[PostgreSQL 9.6](https://www.postgresql.org/download/) and any database
client that can interface with PostgreSQL, e.g. `psql`, pgAdmin.
> Note: We recommend running the database as container or virtual machine to
> avoid cluttering your local development environment. Please consult the
> documentation for your container engine (e.g. Docker) or virtualization
> platform (e.g. VirtualBox or Hyper-V) on how to provision PostgreSQL
> database. If you had to use locally-installed database, make sure your
> own data will not interleave with the data generated by this project.
Verify that Node.js and Python 2 have been successfully installed. Make sure
the interpreter for both platforms can be invoked from the shell. For example,
in `bash` shell (macOS or GNU/Linux-based OS):
```bash
# Assuming there is a Python virtual environment directory named `env` in
# current path
$ source env/bin/activate
$ python --version# or: python2 --version
Python 2.7.16
$ node --version
v4.9.1
```
Now install the packages required by Node.js and Python 2:
```bash
npm install
pip install-r requirements.txt
```
If you are cloning the project for the first time into your local development
environment, you need to create a new database user named `kape` and create a
new database with the same name for this project. Do not forget to set the
ownership of the new database to `kape` user. Once you have finished initalising
the database, perform database migration and seeding:
```bash
python manage.py migrate
python manage.py loaddata seeder.json
```
> Note: Can't connect to the database? Adjust the database connection settings
> at [`settings.py`](kape/settings.py).
Finally, verify that the test suites pass:
```bash
# Run the test suite for backend
python manage.py test
```
To run the test suite for frontend, you need to build the frontend first before
running the test suite:
```bash
npm run build-production
npm run karma
```
## Running Development Mode (Classic)
To run the API (backend) server:
```bash
python manage.py runserver
```
To serve the frontend:
```bash
npm run webpack
# If you don't want live update, run: npm run build
# If you want the uglified, zipped, production-ready version, run: npm run build-production
```
You can see the app running by going to `localhost:8080` via your favourite
Web browser.
## Running Development Mode (Containerised)
If you have installed Docker and Docker Compose, you can build the app
into a container image and run it with container-based database and
Web server:
```bash
docker-compose up --build--detach
docker-compose run --rm app python manage.py migrate
docker-compose run --rm app python manage.py loaddata seeder.json
```
> Explanation:
> 1. Rebuild the application (the frontend + backend), then start it along with
> the database (`postgres`) and Web server (`nginx`).
> 1. Perform database migration
> 1. Perform database seeding
Before you can see the app, you need to know the port in the host that mapped
to the port in the Web server container:
```bash
# The following is just an example. The output may vary in your environment.
*`create user kape password 'kape';` to create user.
*`create database kape;` to create database.
* if you want to create another database user, please update the setting file `kape/settings.py`
*`python manage.py migrate` To migrate all the database
## Run Development Mode App
*`npm run webpack` to run webpack server. (if you don't want live update run `npm run build`, if you want the uglified+zipped+production ready version run `npm run build-production`)
* on a different terminal window, run `python manage.py runserver` to run API server
### Now go to localhost:8000 and you'll see the App running!