Django

Quickly and Easily Way to Create a Django Application: BeDjango Starter

BeDjango starter

In the following post we will talk about the starter we have released from BeDjango.  The decisions we have made, the features we have decided to add and some aspects that we would like to emphasize:

Why did we decide to make a starter?

Although starting a project in Django is a fairly quick and easy process, after developing several applications, we realized that we used to invest a certain amount of time in each project to implement similar features (registry, basic views, validations, configuration of libraries ...) Therebefore, we decided to invest that time in making a starter that we could easily reuse ... But the thing went out of hand and we created a fairly complete Django base application.

Architecture

We decided to modify the initial structure of folders and files that gives us django, many of these files are already being used by the community:

 

We would like to point out that we have added a 'logic.py' file where we place all the logic of code, in this way we gain modularity and improve the way we have to perform the tests, doing these directly against code and not only with access to views. We have also been forced to create managers for all the objects of our models.

Main Features

  • Coverage of code over 95% (98% at the time of release)

  • Custom theme based on bootstrap, with custom and responsive components.

  • User control system (1-step or 2-step registration, login, password recovery ..)

  • Modularity of the applications (users, base)

  • Application ready for internationalization

  • Python2/3 compatibility

Packages included

After reviewing several packages that we often use, we decided to include some already preconfigured ones:

  1. Django debug toolbar
  2. Django cachalot
  3. Material design for admin

Utils

We have also decided to put a series of utils that we needed or that we usually use in most projects:

  • Breadcrumbs

  • Password validation via ajax

  • Decorators: group required, ajax required (to protect views), anonymous required (to prevent logged user to visit some views)

  • Regex for password validation

Requirements

Here are the system requirements needed for the starter to work down a distribution Ubuntu 16.04:

  • Git:

sudo apt install git
  • Pip:

sudo apt install python-pip
  • Virtualenv:

sudo pip install virtualenv
  • Python3-dev:

sudo apt install python3-dev

How to use it

# Create virtualenv
virtualenv -p python3 venv

# Activate virtualenv and install Django
source venv/bin/activate
pip install django==1.10

Use django-admin to create the app using the starter
django-admin.py startproject --template=https://github.com/BeDjango/bedjango-starter/archive/master.zip --extension=py,rst,yml {{nameofproject}}

# Install requirements/dev-requirements
cd nameofproject/nameofproject
pip install -r requirements.txt
pip install -r requirements-dev.txt

# Migrate database 
python3 manage.py migrate

# Compile translations
python3 manage.py compilemessages

# To run our project:
python3 manage.py runserver

 

Contribution

We this release we intend to give back some of the knowledge and the tools which are given by the community but with a processing from our side. We don’t expect to create a project itself, however, we open a Github with a code which could be used and personalized by everyone, and moreover, we will be grateful if we receive some feedback as comments (both pros and cons), proposals or contributions. For that this project is licensed under the MIT License

I hope you try it and like it :)!

About the author

None

How To Create a Tab for Open edX
03.16.2017

How To Create a Tab for Open edX

A tab in open edx is a section inside a course, accessible from any part of it. You can add new StaticTabs for your courses ...

Python Sevilla: ''Starters with Django''
03.10.2017

Python Sevilla: ''Starters with Django''

Have you missed the Python Sevilla meeting for March? Don't worry because BeDjango will tell you everything we learned at ...

Fast Application Development with Django Starters
03.07.2017

Fast Application Development with Django Starters

If you have been working in the software industry for many years you will probably know that one of the principles in ...

Reasons Why Your Business Should Develop a Mobile Application
03.01.2017

Reasons Why Your Business Should Develop a Mobile Application

Look around. How many technological devices do you have near you? Desktop computers, laptops, tablets and obviously ... ...

Framework vs CMS: 3 Questions To Help You Decide
02.21.2017

Framework vs CMS: 3 Questions To Help You Decide

How many times have you asked yourself, when starting a new web project, if you need to use a Framework or CMS? There are ...

Why you should use Django for your next website project?
02.14.2017

Why you should use Django for your next website project?

When embarking upon the development of a new web application, one of the most important questions we must ask ourselves is ...

Let’s have a coffee and talk about your project

START A PROJECT

Let’s have a coffee and talk about your project

START A PROJECT

We use cookies to ensure you get the best experience on our website. More info.

Accept