Skip to content

Building Spokane Tech: Part 3

Welcome to part 3 of the "Building Spokane Tech" series! In this article, we go through steps to get the web app running locally on your machine or environment.

See the live site at: https://www.spokanetech.org

See the latest code on: github

Prerequisites

Local Setup

Cloning the Repo

git clone git@github.com:SpokaneTech/SpokaneTechWeb.git

cd into the repo directory

cd SpokaneTechWeb

Create a python virtual environment

python -m venv venv

Activate the python virtual environment

for linux, mac, or wsl:

source venv/bin/activate

for powershell:

venv\Scripts\activate

Install the python dependencies

pip install .[dev]

** mac users may need to quote the pip install like so: pip install '.[dev]'

Install playwright dependencies

Playwright is used for scraping web data from meetup.com

playwright install --with-deps

Create an .env.local file from the .env.template file and update contents as applicable

cp src/envs/.env.template src/envs/.env.local

cd to the django_project directory

cd src/django_project

Create a local database by running django migrations

python ./manage.py migrate

Create a local admin user

This command creates a superuser superuser in your database and adds the user to the admin group. The username is 'admin' and the password is 'admin'

python ./manage.py add_superuser --group admin

Populate some local test data

This command populates your local database with SocialPlatform and TechGroup data:

python ./manage.py runscript initialize_data

If you'd like to ingest some actual future events data from Eventbrite and Meetup, run this command:

python ./manage.py runscript ingest_events

Start the local demo server

python ./manage.py runserver

Explore the site

open a browser and navigate to http://127.0.0.1:8000

** you can stop the local demo server anytime via ctrl + c

** you can login to the django admin page (at http://127.0.0.1:8000) using admin/admin

Enable Git Hooks (optional)

git config

To enable pre-commit code quality checks, update the location of git hooks with the following command:

git config core.hooksPath .github/hooks

Note: to make a commit with the precommit hooks temporarily disabled, run the following:

git commit --no-verify