Skip to content

Deployment guide

Sami Nouidri edited this page May 2, 2024 · 3 revisions

Deployment Guide

This document outlines the steps necessary to deploy the project on a Windows environment, with or without using our Docker images. The project consists of a Django backend, a Vue.js frontend using Vite, and PostgreSQL as the database.

For Docker users

If you wish to use our images, then it is as simple as installing Docker and running this command :

docker compose up

For users who wish to avoid Docker, continue reading this guide.

Prerequisites

Before you start, ensure you have the following installed on your machine:

Python (3.8 or later)

Node.js (14.x or later)

PostgreSQL (12.x or later)

Git

1. Clone the Project

First, clone the project repository from GitHub to your local machine.

git clone https://github.com/HE-Arc/neurona.git

cd neurona

2. Set Up the Backend

Install Python:

Download and install Python from python.org.

Set up a virtual environment:

Navigate to the project's root directory in your terminal and run the following commands:

pip install pipenv

Install project dependencies

pipenv install

Activate the virtual environment :

pipenv shell

Execute migrations (database must be configured, otherwise ignore):

python manage.py migrate

3. Configure PostgreSQL

Download and install PostgreSQL from PostgreSQL official site.

Create a database:

Open the PostgreSQL command line client, psql, and run:

sql

CREATE DATABASE neuronaApp;

CREATE USER admin WITH PASSWORD 'yourpassword';

GRANT ALL PRIVILEGES ON DATABASE neuronaApp TO admin;

Configure the Django project's settings:

Open the Django project's settings file (settings.py) and configure the DATABASES setting:

python

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'neuronaApp',
        'USER': 'admin',
        'PASSWORD': 'yourpassword',
        'HOST': 'localhost',
        'PORT': '',  # Default is 5432
    }
}

Make Migrations

Generate the database schema by running these commands:

python manage.py makemigrations

python manage.py migrate

4. Set Up the Frontend

Download and install Node.js from Node.js official site.

Navigate to the directory containing the Vue project (frontend folder) and install the necessary packages:

cd frontend

npm install

4. Run the Project

Run the Django Development Server

In the directory of the Django project, activate the virtual environment if it's not already activated and run:

python manage.py runserver

Run the Vue Development Server

Open a new command line window, navigate to the Vue project directory, and run:

npm run dev

This will start the Vite development server, usually accessible via http://localhost:3000.

5. Access the Application

With both servers running, you can access the frontend of your application by opening http://localhost:3000 in a web browser. The backend will be accessible via http://localhost:8000.