Skip to content

Building Taco: DJANGO

Building TACO: DJANGO

This is a quick guide of installing Django in your computer and running TACO

"What really turned me over was the ability to understand how everything works without any prior knowledge."
Pedro Jurado
CTO

Installing DJANGO in MAC

If I was able to create a project in Django, then anybody will manage to install and run the project. There are just a couple of concepts that I want to remark before getting hands dirty, so here we go.

VIrtual environment

Before we can use Django in MAC, we have to do a couple of things as MAC have already installed a version of Python (2.7) that sadly, is not ok for us. Also, trying to remove this version and installing a new shiny Python3 version could be as time consuming as dangerous, it seems that we have some dependencies from the OS and we don’t want to make him angry.

So, instead of doing that, we will use a virtual environment to encapsulate everything we need. You can read more about It here, but if you want to cook your steak now, here are the ingredients:

 

First, lets install PIP to manage easily the installation of packages. You can find more details here, but basically PIP will allow us to install all the dependencies we need with a single command execution. So, if you haven’t done it already, lets start installing python3 and then PIP

Installing python3, you can get more info here:

brew install python3

Installing PIP

python3 -m pip install –upgrade –force pip

Installing virtual environment

sudo pip install virtualenv

 

Creating a virtual environment, you can choose your folder name. Mine is taconenv

virtualenv tacoenv

Move inside the new folder and activate the environment. Doing that, you will be inside a “jail” where your environment will be isolated from the system.

cd tacoenv

source bin/activate

Download DJANGO PROJECT

Well, this is not a tutorial about installing Django but maybe it can be useful if you want to give it a try and install an empty Django project and have a look.

 

Install Django using PIP and check the version. I found problems using pip with sudo, that’s why I’m not using it at all.

pip install django==3.0.4

python -m django –version

(3.0.4)




If you want to create an empty Django project, you can do it with this :

django-admin startproject taco

 

But, if you want to start working with TACO, you will need to download it from the repository. Be careful to do it from your virtualenv folder.

 

git clone https://github.com/pjuradopueyo/taco.git

Install project

Now you have everything downloaded, you need to install all the dependencies. To do that, we will use the file requirements.txt, where all the dependencies are listed

 

You can do one by one, but for the sake of our mental health, you can do it with this command:

pip install -r requirements.txt

DATA BASE AND E-MAIL configuration

Now you need to create a file with all the static content for the email and database configuration (BTW, if you didn’t create a MySQL, do it now!).

 

The file must be named secrets.json and located at the root folder of the project, at the same level of manage.py

{

    “DB_NAME”: “data_base_name”,

    “DB_USER”: “data_base_user”,

    “DB_PASSWORD”: “data_base_password”,

    “DB_HOST”: “127.0.0.1”,

    “EMAIL_USER”: “email@domain.com”,

    “EMAIL_PASSWORD”: “PaswwordEmail”

}

RUNNING THE PROJECT

Now, everything should be ready, so you just need to run the following command and access to your http://localhost:800

 

Run this command to launch the app:

python manage.py runserver

The PrOJECT: DJANGO

Learn how to download the Django/Python project and get it ready in your local machine.

Image Source: WOCinTechChat, Icon Finder

en_GBEnglish