项目作者: reljicd

项目描述 :
Empty Django project template for quick bootstrapping of Django projects.
高级语言: HTML
项目地址: git://github.com/reljicd/django-empty-project-template.git
创建时间: 2017-12-17T12:19:05Z
项目社区:https://github.com/reljicd/django-empty-project-template

开源协议:

下载


Django Template

About

This is a demo project for practicing Django.

It was made using Python 3.6 + Django and database is SQLite.
Bootstrap was used for styling.
Testing is done using untitest module.

There is a login and registration functionality included.

App is covered with tests.

Prerequisites

[Optional] Install virtual environment:

  1. $ python -m virtualenv env

[Optional] Activate virtual environment:

On macOS and Linux:

  1. $ source env/bin/activate

On Windows:

  1. $ .\env\Scripts\activate

Install dependencies:

  1. $ pip install -r requirements.txt

How to run

Default

You can run the application from the command line with manage.py.
Go to the root folder of the application.

Run migrations:

  1. $ python manage.py migrate

Initialize data:

  1. $ python manage.py loaddata users

Run server on port 8000:

  1. $ python manage.py runserver 8000

Helper script

It is possible to run all of the above with helper script:

  1. $ chmod +x scripts/run.sh
  2. $ scripts/run.sh

Docker

It is also possible to run the myapp app using docker:

Build the Docker image:

  1. $ docker build -t reljicd/django-myapp -f docker\Dockerfile .

Run the Docker container:

  1. $ docker run --rm -i -p 8000:8000 reljicd/django-myapp

Helper script

It is possible to run all of the above with helper script:

  1. $ chmod +x scripts/run_docker.sh
  2. $ scripts/run_docker.sh

Post Installation

Go to the web browser and visit http://localhost:8000/home

Admin username: admin

Admin password: adminpassword

User username: dusan

User password: dusanpassword

Helper Tools

Django Admin

It is possible to add additional admin user who can login to the admin site. Run the following command:

  1. $ python manage.py createsuperuser

Enter your desired username and press enter.

  1. Username: admin_username

You will then be prompted for your desired email address:

  1. Email address: admin@example.com

The final step is to enter your password. You will be asked to enter your password twice, the second time as a confirmation of the first.

  1. Password: **********
  2. Password (again): *********
  3. Superuser created successfully.

Go to the web browser and visit http://localhost:8000/admin

Tests

Running tests:

  1. $ python manage.py test myapp