Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Creating a Dev Environment

Jeff edited this page Jul 6, 2023 · 22 revisions

Prerequisites

tip: each of these links are a direct link to the download page of the tool

Code Editors (pick one)

  • Visual Studio Code (recommended code editor)
  • Pycharm (project supports this editor, but you have to pay for Django template linting)
  • vim (you are actually insane if you pick this one)
  • neovim (chad text editor)

Tools

VSCode Extensions (if you're using it)

  • Python (because python)
  • Django (django template syntax highlighting)
  • GitLens (very good extension in general, everyone should have it)

Things to do before setting up

  • Make sure you are logged in to GitHub via GitHub CLI. To do this, run gh auth login in a terminal and follow the steps. If you are not logged in, you won't be able to push to your GitHub repos.
  • You should make sure your IDE/Code Editor supports:
    • Python syntax highlighting and linting
    • Django template syntax highlighting and linting

Tips

  • You can open a PowerShell terminal in a directory by pressing shift+right-click and selecting "Open in Powershell terminal" in the right click prompt. This option is not shown when right clicking normally.
  • In VSCode, to open an integrated terminal you can press ctrl+shift+`.
  • The .vscode and .idea folders contain config helpers for the IDEs: VSCode and IntelliJ IDEA

Setting up a Dev Environment

Step 0: Fork the repo (optional)

If you plan on contributing to this project, you should probably make a form of it (fork button on top right hand corner). If you just want to run the server, you can just continue on.

Step 1: Clone the repo

  • Open up a terminal then navigate to your preferred directory
  • Run git clone https://github.com/worcestertechnicalhighschool/ratatoskr.git
  • Run cd ./ratatoskr
  • Run code . to open VSCode in the current directory

Step 2: Setup a virtual environment

  • In a terminal, run pipenv install

Step 3: Setup the server

  • pipenv shell (do this every time you want to run the server)
  • cd ./ratatoskr
  • python manage.py migrate
  • python manage.py initsocialapp

Step 4: Run the server

  • python manage.py runserver

Step 4.5: Debugging the app

  • Debugging is already configured for VSCode. All you have to do is press the run button on the debug tab.
  • If you have another preferred IDE, you can configure debugging yourself.

Other steps to make your life easier

Recommended VSCode configurations

I would really recommend disabling the Django extension by default mostly due to it hijacking control over all .html files. You can enable it only for one workspace by clicking the dropdown arrow beside "Enable" and clicking "Enable (workspace).

Also, if you navigate to your settings.json (ctrl+,, then click on the paper icon on the top right), you can add the following snippet to re-enable Emmet while editing Django templates

    "emmet.includeLanguages": {
        "django-html": "html"
    },

If intellisense is reporting unresolved imports, you have to switch your Python environment to the virtual environment. Do this by clicking the Python version on the bottom left and select the virtual environment.