Click to expand
- Python 3.10+ (latest, stable version preferred)
- Having cloned this repository to your machine
- For most purposes, check out the
dev
branch, as it's the base branch for all development:git clone https://github.com/MAKENTNU/web.git git checkout -B dev origin/dev
- For most purposes, check out the
We recommend using PyCharm for development, mostly because of its excellent Django support,
and because it's able to integrate all the IntelliJ-specific settings in the project's .editorconfig
file.
If you decide to use this IDE, open the repo folder cloned as part of the prerequisites, through PyCharm (File → Open...), and set the following settings (File → Settings...):
- Under "Languages & Frameworks" → "Django":
- Make sure the "Enable Django Support" checkbox is checked
- "Django project root:"
<repo folder location>/src
- "Settings:"
web/settings.py
- "Manage script:"
<repo folder location>/manage.py
- Under "Project: <repo folder name>" → "Project Structure":
- Mark the
src
folder as "Sources"
- Mark the
- Create a virtual environment, presumably named
venv
:- This should be placed in the folder containing the project folder, and not inside the project folder itself
- Example folder structure (where
web
is the name of the project folder):MAKE ├─ venv └─ web └─ README.md (this file)
- Among other things, this prevents translations from being made inside the virtual environment folder
when running the
makemessages
management command - If using PyCharm, and a virtual environment was not created as part of the project creation process, refer to the "Configure a virtual environment" guide
- Otherwise,
cd
to the project folder, and run:[newest installed Python command, like python3.11] -m venv ../venv
- Example folder structure (where
- This should be placed in the folder containing the project folder, and not inside the project folder itself
- Activate the virtual environment:
- If using PyCharm, this should be done automatically when opening a terminal tab inside the IDE
- Otherwise,
cd
to the project folder, and run:- On Windows:
..\venv\Scripts\activate
- On Linux/macOS:
source ../venv/bin/activate
- On Windows:
- Install requirements:
- If using Windows, first download the correct wheel for the
python-ldap
package from Christoph Gohlke's python-ldap-build repository. and install it:(It is possible to instead buildpip install [path to .whl file]
python-ldap
from source, but it's a bit cumbersome setting up the right build tools.) - Regardless of operating system, run:
pip install -r requirements.txt
- If using Windows, first download the correct wheel for the
- Create an SQLite database file with the proper tables:
python manage.py migrate
- Create an admin user for local development:
It's easiest to create one with both the username and the password set to "admin", and with no email address.
python manage.py createsuperuser
- Run the server:
- If using PyCharm, just press the green "play" button in the top right corner
- Make sure that the correct run configuration is selected in the dropdown next to the button, which by default should be named "web" and have a tiny Django logo
- Otherwise, run:
python manage.py runserver [optional port number; defaults to 8000]
- If using PyCharm, just press the green "play" button in the top right corner
See CONTRIBUTING.md for the following topics:
Visit the wiki to read about various things related to development of this project!
The changelog is updated on the dev
branch when changes are made to the codebase -
specifically under the "Unreleased" section.
This section is then renamed to the current date whenever a deployment pull request is merged into
the main
branch, and a new, empty "Unreleased" section is added.