GithubHelp home page GithubHelp logo

mjtmace / django-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hstewart93/django-template

0.0 1.0 0.0 46.1 MB

Template django repository with database connection for testing out OOP and database relations

Python 1.50% HTML 0.95% JavaScript 85.78% CSS 11.77%

django-template's Introduction

django-template

Template django repository with database connection for testing out OOP and database relations. This is a Python 3 project running Django 3. Clone down this repo and follow the installation instructions to get started with a Django project.

Installation

Pipenv

This project uses pipenv to manage python package requirements. This means that all development should be done within the virtual environment. The following command will initialise the virtual environment and install the dependencies, which can be managed in the Pipfile.

pipenv install --dev

We use the --dev flag to hierarchically install the development and production environments. This means, if you have development requirements such as pytest these will be installed, if you just run pipenv install you development requirements will not.

To activate your virtual environment, run:

pipenv shell

To add a new requirement to your virtual environment 'template', add a new line to the Pipfile with a pinned version. Alternatively, run the following for a production requirement:

pipenv install my-library

Or for a development requirement:

pipenv install --dev my-dev-library

If you want to find the location of your virtual environment, eg. for setting up your IDE run the following from within the shell.

pipenv --venv

Pre-commit

This project uses the black auto formatter which can be run on git commit if you install pre-commit. Black formats the code committed to a pre-defined standard which can be customised to your needs if required. See the docs for the defined code style.

Pre-commit is also configured to run flake8 on commit which will pick up linting errors. See the docs.

To install pre-commit run the following from within your virtual environment.

pre-commit install

Black and flake8 should now run on commit. If there are formatting errors the commit will fail and you will need to re-commit the changes made by black.

Database

You will need to create the database for the application to connect to. The Django project uses postgres which you will need to have installed on your machine. To create the database run the following:

createdb django_db

To migrate any Django relations generated on setup and any existing model relations in your code you will need to run

python manage.py migrate

Once you have some models in your code you will want to create a migration to run against your database. Do this by running

python manage.py makemigrations

Run these migrations using the python manage.py migrate command as above. See the Django docs for all further instructions on setup and development.

django-template's People

Contributors

hstewart93 avatar mjtmace avatar

Watchers

 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.