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.
-
Go into the
backend
directory:cd backend/
-
In the
backend/config/settings
directory, create a copy of the file.env.example
and rename it.env
only. -
Install dependencies and create a virtuel environment for python:
pipenv install --dev
If you get an error with the Python version, install pyenv.
-
Create your database for django:
pipenv run django migrate
-
Create an administrator account on this database:
pipenv run django createsuperuser
When asked, complete as follow:
- username:
admin
- email:
admin@ec-nantes.fr
- password:
admin
Note: if
admin
already exists, runpipenv run django changepassword admin
to change the password of the admin account toadmin
. - username:
-
Now, change your working directory to the
frontend
one:cd ../frontend
-
Install the dependencies:
npm install
-
Then, change your working directory to
email-templates-generator
:cd ../email-templates-generator
-
Install the dependencies:
npm install
-
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:
- Go into the frontend directory and launch the frontend server (react):
cd frontend/
npm run start - In another terminal, go into the backend directory and launch the backend server (django):
cd backend/
pipenv run start
- Local
- Github Codespaces
- Open this address in your browser: http://localhost:8000
-
The ports 8000 and 5173 are automatically forwarded by VScode. The port 8000 is automatically opened in a new tab.
-
Go back into the vscode tab of your browser. You need to change the visibility of the ports to public:
- open the Ports tab on the bottom bar of VS code
- right click on each port, and select Port visibility > Public
You can also run this command to change the visibility of both ports:
gh codespace ports visibility 5173:public 8000:public --codespace $CODESPACE_NAME
-
Go back to the tab previously opened automatically.
And that's it! You should now see the login page of Nantral Platform:
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!
-
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.
- 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
-
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
pipenv run django changepassword admin
- Note: if the password does not work, you can reset the password:
-
Once connected, open "Account > Users" (or "Account > Utilisateurs" in French)
-
Search for your personal account (the one you created a few minutes ago) and open it.
-
Scroll down to the Permissions section, and check the 3 checkboxes:
Active
(Actif): this will validate your accountStaff status
(Statut équipe): this allows you to connect to the admin panel with your personal accountSuperuser status
(Statut super-utilisateur): this transforms your personal account into an admin account!
-
Save your modifications with the button at the bottom.
-
Log out from the admin interface.
-
Finally, go back to Nantral Platform (http://localhost:8000), and log in with your personal account!
-
Congratulations, you now have a personal admin account on your database 🥳
To go further...
In facts, on Nantral Platform, we have 2 tables in our database for representing
a user: the first one is called User
, and the second one Student
. The
User
table is made for the authentification and permissions processes, and the
Student
one is made for the profile of the user.
The admin account is only created during the installation process as an
element of the User
table, and has no equivalent in the Student
table:
hence, the admin account will not really work on Nantral Platform. That's why
you need to create your account with the login page, to have both enabled.