Skip to content
forked from MAKENTNU/web

A fork of https://github.com/MAKENTNU/web containing changes that should not be in / are not necessary to have in that codebase - i.e. a sandbox :) An "archive" of highlights can be viewed at https://github.com/MAKENTNU/web-sandbox/tags

License

Notifications You must be signed in to change notification settings

MAKENTNU/web-sandbox

 
 

Repository files navigation

web

build codecov

Setup

Click to expand

Prerequisites

  • 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

PyCharm

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"

Installation

  1. 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
  2. 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
  3. Install requirements:
    • If using Windows, first download the correct wheel for the python-ldap package from Christoph Gohlke's page (linked to by python-ldap's documentation) and install it:
      pip install [path to .whl file]
      (It is possible to instead build 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

Running the server for the first time

  1. Create an SQLite database file with the proper tables:
    python manage.py migrate
  2. Create an admin user for local development:
    python manage.py createsuperuser
    It's easiest to create one with both the username and the password set to "admin", and with no email address.
  3. 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]

Contribution guidelines

See CONTRIBUTING.md for the following topics:

Visit the wiki to read about various things related to development of this project!

Changelog

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.

About

A fork of https://github.com/MAKENTNU/web containing changes that should not be in / are not necessary to have in that codebase - i.e. a sandbox :) An "archive" of highlights can be viewed at https://github.com/MAKENTNU/web-sandbox/tags

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Python 70.2%
  • HTML 18.2%
  • JavaScript 8.6%
  • CSS 3.0%