Skip to content

sleepypioneer/lagreene-ceramics

Repository files navigation

Portfolio Site for Lesley Anne Greene Ceramics

This is the portfolio site for Lesley Anne Greene a ceramic artists based in East Yorkshire, in the United Kingdom.

Development 🐍🖥️

This project uses the following technologies

  • Python 3.11
  • Django 5
  • pytest
  • Javascript, Jquery
  • HTML & CSS
  • Bootstrap 4
  • Terraform
  • It is connected to a postgresql database instance
  • Static files are saved to Amazon S3

Getting started ⚙️

Virtual environment

This project uses uv for package management. To install dependencies run:

make deps
Setting environment variables

Copy app/.template_env to app/.env and fill in the required values.

For local development, you need:

SECRET_KEY=your-secret-key-here
DATABASE_URL=postgres://jessica-g@localhost:5432/nameforlocaldb
DJANGO_DEBUG=True
USE_S3=False

Generate a Django secret key with:

uv run python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

Note: The other variables in the template (DATABASE_NAME, DATABASE_USER, etc.) aren't needed since DATABASE_URL is used by dj-database-url. AWS variables are only required if USE_S3=True. Heroku variables are only for deployment.

Running the App locally

# Make migrations
make migrations

# Implement migrations
make migrate

# You can also add the app name at the end to apply migrations only from that app.

#Collect Static files - if $USE_S3 is set to TRUE then files will be saved to S3 Bucket
make collectstatic

#Run the tests
make test

#Run the server default port is 8000
make dev

Creating a local database for local development

For development you may want to have your own local database and save static files locally instead of using Amazon S3.

A local copy of the Heroku postgres can be made with the following command:

# Install Heroku CLI
# macOS/Linux (script):
curl https://cli-assets.heroku.com/install.sh | sh
# macOS (Homebrew):
brew tap heroku/brew && brew install heroku
# Windows (Winget):
winget install --id HerokuCLI
# Authenticate:
heroku login
# Pull remote Heroku Postgres to local:
PGUSER=postgres PGPASSWORD=password heroku pg:pull DATABASE_URL nameforlocaldb --app lagreene-ceramics

Note that PGUSER and PGPASSWORD set the authentication credentials for the local db, and the Django app has the database URL saved as an environment variable.

*If the above doesn't work it may be necessary

DJ-Database-URL utility is used to configure the environment variable of the database so all that is now needed is to update the $DATABASE_URL value to the new local database:

DATABASE_URL=postgres://postgres:password@localhost:5432/nameforlocaldb

You will have to run the migrations on the local database with make migrate and also create a super user uv run python app/manage.py createsuperuser.

To stop using S3 for static and media files set the environment variable $USE_S3 to FALSE.

Creating infrastructure with Terraform

ℹ️ If you want to create an app and resources from this code you can do so with terraform, more information on how to do so can be found here

Starting the app with Gunicorn 🦄

You can also run the App with Gunicorn by running gunicorn portfolio_site.wsgi:application

Run inside a container with Docker 🐋

The app can also be ran within a docker container, first build the app with:

make docker-build

then run the image:

make run-in-docker

Other documentation 🗒️

Here you will find some notes taken during the development of this site which include useful commands, links and tutorials.

Linting 🚩

This project has python linting set up using pycodestyle to run it use pycodestyle . Autopep 8 can be used to change files in place with the following command: autopep8 --in-place --aggressive --aggressive ./<file-path>

Core Styles 🎨

For reference here are the main colours and font styling, for more information please look in the relevant CSS file.

Headings and navbar:            #88A0A8
Paragraph/ text:                #66666E
Background:                     #EFEEEA
Contrast background:            #EEE3AB

Fonts:
Main:                          Archivo Narrow

Feedback Welcome! 📨

See something which could be improved? Please feel free to open a pull request, open an issue or message @sleepypioneer :)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors