diff --git a/readme.md b/readme.md index a08bad4..79368fc 100644 --- a/readme.md +++ b/readme.md @@ -2,60 +2,95 @@ ## Installation -### Create virtualenvironment for python +### Create a virtual environment for python -virtualenv -p python3 virtualenv.sikweb +`virtualenv -p python3 virtualenv.sikweb` -### Install py3 dev -`sudo apt-get install python3-dev` +### Clone this repository and enter it -### clone This repo and enter it +Set up your SSH key authentication in GitLab Profile Settings. Then clone the repository: -git clone url_to_repo +``` +git clone git@sika.sahkoinsinoorikilta.fi:vtmk/web2.0.git +cd web2.0 +``` -cd url_to_repo +Change to the development branch: -### Activate virtualenv (assuming we are on root of this repo and virtualenv is one step above) +``` +git checkout develop +``` + +### Activate virtualenv (assuming we are at the root of this repository and virtualenv is one level above) `. ../virtualenv.sikweb/bin/activate` -### install required python modules - -`pip install --upgrade pip` - -`pip install -r requirements.txt` - - ### Install Mariadb and create necessary tables -`sudo apt-get install mariadb` +#### Run the following commands to install dependencies and to run the mariadb installation script + +``` +sudo apt-get install mariadb-server libmysqlclient-dev python3-dev libffi-dev python3-cffi +sudo mysql_secure_installation +# Setup root password and say yes to all other questions +sudo mysql -u root -p +# Log in with your new password +``` + +#### Create a user called 'sik' with password 'password123' and create the db + +**PLEASE CHANGE THE PASSWORD TO SOMETHING MORE SECURE!** + +Paste the following into the mysql client prompt: ```SQL -CREATE USER 'sik'@'localhost' IDENTIFIED BY 'jokutmpassu'; +CREATE USER 'sik'@'localhost' IDENTIFIED BY 'password123'; CREATE DATABASE sik DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON sik.* TO 'sik'@'localhost'; CREATE DATABASE sik_test DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON sik_test.* TO 'sik'@'localhost'; ``` -## Configure django's settings +### Install required python modules -cp sikweb/settings-sample.py sikweb/settings.py +``` +pip install --upgrade pip +pip install -r requirements.txt +``` -edit database settings from sikweb/settings.py according to what you used above. -run `./manage.py migrate` +## Configure Django settings -you should be now have succesfully setup a devel version of sikweb 2.0 +`cp sikweb/settings-sample.py sikweb/settings.py` + + +Change the following fields in sikweb/settings.py: + +``` +NAME (default: sik) +USER (default: sik) +PASSWORD (default: password123) +``` +under DATABASES -> 'default' around line 80. + +## Run migrations +`./manage.py migrate` + +You should be now have succesfully set up a development version of SikWeb 2.0 ## Running ### Activate virtualenv -assuming we are on root of this repo and virtualenv is one step above: +Assuming we are on root of this repo and virtualenv is one step above: `. ../virtualenv.sikweb/bin/activate` -### use runserver command -`./manage.py runserver` +### Use runserver command -`or./manage.py runserver 0.0.0.0:8000` if you need to connect from anywhere else than localhost +`./manage.py runserver` + +or + +`or./manage.py runserver 0.0.0.0:8000` + +if you need to connect from anywhere else than localhost. \ No newline at end of file