Skip to main content

First Launch

It's time to run Nantral Platform on your computer!

Set up the project​

Open a terminal in the nantralPlatform directory (for convenience, you can open this terminal inside of VS Code but it also works if you use your regular terminal), and run:

make install

It creates a new virtual environment and installs all the dependencies for the back end and the front end, and creates a new database for you with a default admin user.

Help! The make command does not work with me! 😥

Well, sorry you're not lucky! But don't worry, here are all the steps you can do to install everything.

  1. Go into the backend directory:

    cd backend/
  2. In the backend/config/settings directory, create a copy of the file .env.example and rename it .env only.

  3. Install dependencies and create a virtual environment for python:

    uv sync --dev

    If you get an error with the Python version, install pyenv.

  4. Create your database for django:

    uv run manage.py migrate
  5. Create an administrator account on this database:

    uv run manage.py createsuperuser

    When asked, complete as follow:

    • username: admin
    • email: admin@ec-nantes.fr
    • password: admin

    Note: if admin already exists, run uv run manage.py changepassword admin to change the password of the admin account to admin.

  6. Now, change your working directory to the frontend one:

    cd ../frontend
  7. Install the dependencies:

    npm install
  8. Then, change your working directory to email-templates-generator:

    cd ../email-templates-generator
  9. Install the dependencies:

    npm install
  10. And build the email templates:

    npm run build

Congratulations, you did it all 🥳

When the installation is finished, refresh your IDE: for VScode, tap

Ctrl+Shift+P, search for "Reload Windows", and tap Enter.

Start the server​

Now it's time to launch the website! To do this:

  1. Go into the frontend directory and launch the frontend server (react):
    cd frontend/
    npm run start
  2. In another terminal, go into the backend directory and launch the backend server (django):
    cd backend/
    uv run manage.py runserver
  1. Open this address in your browser: http://localhost:8000

And that's it! You should now see the login page of Nantral Platform:

The login page

Create your admin account​

Since we have created your own database, you do not have an account yet on this particular database. So let's create one!

  1. On the login page, click the "No Account?" button, and fill in your info to create your personal account.

    Note
    • Your password will be only stored on your computer: this is not really secure, so do not use a password similar to your real online accounts! You can instead use a dummy password like password for example.
    • The email will not really be checked, so you can use a dummy one too (it must only finish with ec-nantes.fr). This allows you to create multiple accounts, to test your code later 😉
    • At the end of the process, the website will ask you to validate your account: just ignore it for the moment.
  2. Now, open the admin panel (http://localhost:8000/admin), and log in with the fake admin account created by default (username: admin@ec-nantes.fr, password: admin)

    • Note: if the password does not work, you can reset the password:
      cd backend
      uv run manage.py changepassword admin
  3. Once connected, open "Account > Users" (or "Account > Utilisateurs" in French)

  4. Search for your personal account (the one you created a few minutes ago) and open it.

  5. Scroll down to the Permissions section, and check the 3 checkboxes:

    • Staff status (Statut équipe): this allows you to connect to the admin panel with your personal account
    • Superuser status (Statut super-utilisateur): this transforms your personal account into an admin account!
    • Verified email (next to your email at the bottom of the page): this allows you to log in with this new account!
  6. Save your modifications with the button at the bottom.

  7. Log out from the admin interface.

  8. Finally, go back to Nantral Platform (http://localhost:8000), and log in with your personal account!

  9. Congratulations, you now have a personal admin account on your database 🥳

Use docker for development​

For a more detailed version, visit the docker page.

If you have docker installed, you may want to use it to develop the project. This allows to have a clean isolated environment at the cost of slightly higher ressources usage. To set up the containers, just run make docker-install to initialize the project. Then, in order to start the project, run make docker-start. You may proceed with regular setup instruction (admin account) from now on. The server is running at http://localhost, and the fake mailserver at http://localhost:8025

Some useful commands:

  • Change directory to the docker root: cd deployment (needed for the following commands)
  • Open a terminal in the container: docker compose exec -it backend-develop bash (first start the container)
  • Manually start / shutdown docker: docker compose up --watch and docker compose down