Coder Social home page Coder Social logo

recipes-site's Introduction

A simple website for family recipes, made with django.

Dependencies

  • System-wide: docker, docker-compose, python3, django
  • Python: See requirements.txt

To set up development environment

  1. Create file .env, hidden from version control, which sets the variables POSTGRES_USER, POSTGRES_PASSWORD, POSTGRESS_DB, and SECRET_KEY
  2. Run the docker container: sudo docker-compose up.
  3. Create python virtual environment: python -m venv env
  4. Enter python virtual environment: source env/bin/activate
  5. Install required python packages: pip install -r requirements.txt
  6. Make initial migrations: python manage.py migrate
  7. Create an admin user for the local database: python manage.py createsuperuser
  8. Start the development server: python manage.py runserver --settings base.settings.dev
  9. Start the vite development server for js componenents: From the "frontend" directory, run npm run dev
  10. Preview site in browser at localhost:8000

To make model changes and migrations

  1. Change models (models.py)
  2. Run python manage.py makemigrations to create migrations for those changes
  3. Run python manage.py migrate to apply those changes to the database.

To deploy changes to production

  1. In a development environment, push changes to the dev branch. To push frontend changes, run npm run build and then push the automatically generated changes.
  2. On the production server, check out the dev branch (git checkout dev) and pull the latest changes (git pull).
  3. Enter python virtual environment: source env/bin/activate
  4. Run the production server: python3 manage.py runserver --settings base.settings.production
  5. Collect static files (so that nginx will manage them): python3 manage.py collectstatic --settings base.settings.production
  6. If models have changed, apply migrations: python3 manage.py migrate --settings base.settings.production
  7. If everything looks good, check out the main branch on the production server (git checkout main) and merge changes from dev (git merge dev).

recipes-site's People

Contributors

hoffmanmc avatar opmorgan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.