- Works on both Windows and Linux (preferably either Debian or Debian-based distribution)
- Minimum 2GB RAM
- Minimum 16GB HDD
- Open powershell and navigate to a folder you like the code to be stored.
- Run command
git clone https://github.com/Team-Fenris/fenrisCMS.git
- Run command
pip install -r requirements.txt
- Open folder in a IDE(preferably)
- Create a database
- Edit database settings in Settings.py
- Run
python manage.py makemigrations
- Run
python manage.py migrate
- Open powershell as
admin
.
start-process powershell -verb ruans
Or you can search "Powershell", rightclick and Run as administrator
.
-
Use the
cd
command to navigate to a directory you want to work in. Once inside the directory of your choice runmkdir
command and give your new directory a name. -
If you want to use a virtual enviorment you can install pyenv inside the newly created directory. Inside powershell run the command
pip install virualenv
to install and to runvirtualenv pyenv
. whenever you want to work inside thevirtualenv pyenv
you run.\pyenv\scripts\activate
inside powershell. -
In powershell type
Python
and check if it is installed. if it isn`t installed runpip install python
. -
Install
django-datatables-view
, in Powershell typepip install django-datatables-view
-
To interact with the database using Python we also need to install a database interpreter, in Powershell run
pip install psycopg2
. This is a Python specific PostgreSQL adapter for issuing commands to the database. -
We are also going to need Git in order to clone the repo. Depending if your using an IDE like Visual studio code or your using powershell. If you're using VScode you import the Git module. If you're using windows and powershell follow this guide
https://www.develves.net/blogs/asd/articles/using-git-with-powershell-on-windows-10/
-
After installing all the different applications and dependecies we are finally going to clone the Repo. Navigate to the folder where you created the virtual enviorment and type
git clone https://github.com/Team-Fenris/fenrisCMS.git
.
- We are using PostgreSQL so you need to install that aswell. Its very simple, go to
https://www.postgresqltutorial.com/install-postgresql/
and follow their guide. - Once completed with the postgres installation open up
SQL Shell (psql)
and login to your database and we're going to create a new user. - Create a new user to work with from django.
CREATE USER username WITH PASSWORD 'password';
Next we will give access to the database for the new database and user we created.
GRANT ALL PRIVILEGES ON DATABASE database TO username;
Now that we are done type
\q
And exit out of the postgres shell
exit
- After the user has been created and access to the user have been given we have to change some settings in the settings.py file.
- Once the settings have been changed you run these two commands in the main directory
python manage.py makemigrations
python manage.py migrate
When installing Linux (e.g. Ubuntu), create a user called testdev
.
- Install packages needed.
sudo apt install python3-pip python3-psycopg2 git
- Install packages
sudo apt-get update && apt-get install apache2 git python3 postgresql postgresql-contrib postgresql libpq-dev postgresql-client python3-dev libpq-dev curl ca-certificates python3-pip -y
- Edit
pg_hba.conf
Change from this line:
local all postgres peer
to
local all postgres,testdev peer
- Start PostgreSQL
sudo systemctl start postgresql
4.1 We are using PostgreSQL so you need to install that aswell. Its very simple, go to https://www.postgresqltutorial.com/install-postgresql/
and follow their guide.
4.2 Once completed with the postgres installation open up psql
and login to your database and we're going to create a new user.
4.3 Create a new user to work with from django
postgres=# CREATE DATABASE fenrisdb;
postgres=# \c fenrisdb;
fenrisdb=# CREATE USER testdev WITH PASSWORD 'testdev';
fenrisdb=# GRANT ALL PRIVILEGES ON DATABASE fenrisdb TO testdev;
Now that we are done type
\q
You should be able to run the following command from the testdev
user when logged into the Linux terminal:
testdev@host:~$ psql -d fenrisdb -U testdev
fenrisdb=> \conninfo
You are connected to database "fenrisdb" as user "testdev" via socket in "/var/run/postgresql" at port "5432".
When this is up and running, and works, Django can be integrated.
- Clone the repository (or extract from archive)
git clone https://github.com/Team-Fenris/fenrisCMS.git
- Install Python libraries
cd fenrisCMS
pip3 install -r requirements.txt
- Change settings.py located in the
loganalyzer/
directory
ALLOWED_HOSTS = ["127.0.0.1", "0.0.0.0", "your-ip-address-here"]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'fenrisdb',
'USER': 'testdev',
'PASSWORD': 'testdev',
'HOST': 'localhost',
'PORT': '5432',
}
}
- Run migrations to install the Django data to the database
$ cd fenrisCMS
testdev@testdev:~/fenrisCMS $ python3 manage.py makemigrations
testdev@testdev:~/fenrisCMS $ python3 manage.py migrate
On the prompt if any fields are changed, choose no on all.
- Run the Django server
testdev@testdev:~/fenrisCMS $ python3 manage.py runserver 0.0.0.0:8000
Your Django server should now be up and running, and you should get a message like:
System check identified 8 issues (0 silenced).
April 11, 2021 - 16:44:05
Django version 3.2, using settings 'loganalyzer.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
You can now request Django on https://{Django-IP}:8000