-
Notifications
You must be signed in to change notification settings - Fork 20
Setup
Web development is fiendishly complex. There is code, tools for managing code, and tools for managing tools.
These are the software you are required to download and install. Unless noted, default settings are OK. Consult with officers on advice for preferences of certain settings.
There are other ways to install the following items. The instructions here will provide the EASIEST and SUFFICIENT way to install them. Ultimately, it is up to you on how to get them and install them if you want to do a more centalized way (i.e. Chocolatey for Windows) or a fancy pants method (i.e. Build from Scratch).
When Unix is used, it includes (not limited to) Linux, Windows WSL, and MacOS. For obvious reasons, it doesn't include Windows.
-
gitand Terminal- Unix systems usually have these out of the box
- Default terminal usually
zshorbash
- Default terminal usually
- [Windows] git bash ONLY (due to Makefile syntax)
- You can use the default options, with one exception: Select
Use Windows' default console windowin the Configuring the terminal emulator to use with Git Bash step. Do not use "MinTTY".- This is very important! If you do not select this option, your terminal won't work with Python!
- If you already have Git Bash installed before, just redownload and rerun the EXE (no need to uninstall, but you may if you want or need to) and go through all the options (it should keep what you previously selected). On the Configuring the terminal emulator page, select
Use Windows' default console window.
- You can use the default options, with one exception: Select
- Unix systems usually have these out of the box
- Miniconda (or Anaconda) + Python 3.7.3
- Our server will also use Miniconda to allow for some flexibility in installing packages without having to wait for OCF to install them for us, like upgrading the Python version. As of Spring 2023, we currently use Python 3.7.3.
- Install instructions here: Setup Conda Environment
- Commands Summary:
- Initial setup:
conda env create -f config/tbpweb-dev.yml, uses aymlConda environment configuration file to set up atbpweb-devenvironment (from environmental variables to Python Pip packages) - Activate the conda environment with
conda activate tbpweb-dev(do this every time you start developing ontbpweb) - Deactivate conda environment with
conda deactivate - Remove the conda environment with
conda env remove -n tbpweb-dev - Disable automatic
baseenvironment activation withconda config --set auto_activate_base false
- Initial setup:
- Ruby (OCF uses 2.7.7, but we can use 3.1.X)
- Windows should use
Ruby+Devkit - Install "Compass":
gem install compass -v 1.0.3 - Only purpose is to support the Compass Sass library that is in Ruby
- DO NOT install Ruby 3.2.X or beyond that, for "compass" compatibility. MacOS can install Ruby via Homebrew by:
brew install ruby@3.1
- Windows should use
Create a fork of the program
Once you've installed and setup the above programs, clone the forked repository to your computer:
git clone https://github.com/GITHUB_USERNAME/tbpwebThen, with a terminal, cd into your newly cloned repository:
cd tbpwebDeveloping on tbpweb requires a virtual environment so that every developer has the exact same development environment (i.e. Any errors that a developer has is not due to a difference in configuration). We will be using Conda Environments to make our virtual environment.
Others exist like Python's built-in venv, but we won't use that here
Create your Conda environment and install the Python Pip dependencies if you haven't done so already:
$ conda env create -f config/tbpweb-dev.ymlThis will create a Conda environment with all the Python Pip packages to keep as a standard between development environments. You will only need to
wait for setup once. In the future, you may turn it on with conda activate tbpweb-dev and it will already be setup.
There is one difference in the Conda environment between Production and Development is the TBPWEB_MODE variable. During Production, the Conda environment variable will have a production value. During Development, the Conda environment variable will have a dev value. Look in the config folder's dev and prod .yml files to see how they work.
If you need to create your Conda environment from scratch, this command creates our Conda Environment completely from scratch, simply run the command again
Next, we need to have our current terminal/shell use the Conda environment we just created. We do this through:
$ conda activate tbpweb-devIn summary, the setup looks like:
$ cd tbpweb # enter our main directory
$ conda env create -f config/tbpweb-dev.yml # create our Conda Environment and install dependencies
$ conda activate tbpweb-dev # enter our Conda Environment
$ python manage.py makemigrations # Create migrations files
$ python manage.py migrate # apply all database changes
$ python manage.py runserver # start local web server (127.0.0.1:8000)
$ conda deactivate # Exit the Conda EnvironmentDjango will also require a working copy of MySQL (or MariaDB) for deployment. Development just needs SQLite3.
To run the Django development server (which runs a web server locally), run
$ python manage.py runserverwhich will make the web site available at http://127.0.0.1:8000.
You may also use python manage.py runserver 0.0.0.0:3000 to use http://localhost:3000 or http://0.0.0.0:3000
If you would like to access the admin interface in the local web server, run
$ python manage.py createsuperuserYou will be prompted for some login info, after which you should be able to access the admin interface with your super user credentials at http://localhost:3000/admin.
Usually, any differences in Python code behavior between the Operating Systems are rare. A good rule of thumb is that if you have to use any OS-dependent code, you should consult with someone to see if there are alternatives.
However, Windows developers have the additional responsibility to make their code Linux-friendly (since our destination OS is Linux on OCF). Therefore, if there is an error on the code on Linux and not Windows, support on Linux takes precedence!
Unix developers should also try to make their code Windows-friendly for Windows developers. Example with strftime ... Fixes made here
This is a compilation of past errors and how they were solved.
Git Bash's Terminal emulator should be Use Windows' default console window. Don't use MinTTY. Follow the instructions for reinstalling Git Bash in the Prerequisites section of this README.
Homepage
Guide
- Basics
- Recommended Onboarding Pacing Schedule
- Comprehensive Setup (Forking, Cloning, and Dev Environment)
- Setup
- Django Development Tutorial
- Other Software Engineering Useful Topics
- Contribution Procedure
- Layout
- Deployment
- Server Administration
- Git Guide
- Style
- FAQ
- For Maintainers
Rails - unmaintained - leftover to serve as source of inspiration for other wiki pages