DEV Community

Cover image for Building Spokane Tech: Part 3
David for SpokaneTech

Posted on • Originally published at spokanetech.github.io

Building Spokane Tech: Part 3

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
Enter fullscreen mode Exit fullscreen mode

cd into the repo directory

cd SpokaneTechWeb
Enter fullscreen mode Exit fullscreen mode

Create a python virtual environment

python -m venv venv
Enter fullscreen mode Exit fullscreen mode

Activate the python virtual environment

for linux, mac, or wsl:

source venv/bin/activate
Enter fullscreen mode Exit fullscreen mode

for powershell:

venv\Scripts\activate
Enter fullscreen mode Exit fullscreen mode

Install the python dependencies

pip install .[dev]
Enter fullscreen mode Exit fullscreen mode

** 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
Enter fullscreen mode Exit fullscreen mode

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

cp src/envs/.env.template src/envs/.env.local
Enter fullscreen mode Exit fullscreen mode

cd to the django_project directory

cd src/django_project
Enter fullscreen mode Exit fullscreen mode

Create a local database by running django migrations

python ./manage.py migrate
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Populate some local test data

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

python ./manage.py runscript initialize_data
Enter fullscreen mode Exit fullscreen mode

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

python ./manage.py runscript ingest_events
Enter fullscreen mode Exit fullscreen mode

Start the local demo server

python ./manage.py runserver
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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

git commit --no-verify
Enter fullscreen mode Exit fullscreen mode

Top comments (0)