Trending:

How to build a django-app like this webpage?

Introduction:

Obviously, there are many ways to build website like this one. I am going to show you the basic steps and tools I used for this project. First, let me list some of the resources that I used frequently for this project.

If you are new to Django, I think Django's tutorial is the best place to start. I also started at django's tutorial and then got more comfortable following a book titled "How To Tango With Django" which is freely available online. There are many other books are available free in pdf format. But as I got more comfortable, I actually started to go through the django's documentation. Probably, StackOverflow is the tool I use the most specially when the project was not working. Most of the time it got some sort of solution to the problem. For html, CSS, JavaScript, jQuery, Bootstrap, I use w3Schools, it is the best. For this project, Python is the main backend laguage. There are many free online tutorials to learn python. Frequently, I found some nice tutorials at Real Python Tutorials. You may find this website very useful to learn python. Pandas is a data analysis package for python programming. If you are new, take a look at a quick tutorial.

Installation & Initial Setup:

Since I am using a linux device, these are the installation steps in a linux enviroment. The list of the python packages that need to be installed for this project is:

  • python3.6
  • virtualenv
  • django2.1.5
  • pillow
  • psycopg2
optional:
  • faker
  • misaka
  • django[argon2]
  • django[bcrypt]
  • django-debug-toolbar
  • nose

First, install python in linux enviroment if it isn't already?.

              sudo apt-get update
              sudo apt-get install python3.6
            
Lets create a project folder, lets call it 'project_dir' and cd into it, install virtualenv:
              $ mkdir project_dir
              $ cd project_dir
              $ pip install virtualenv
            
Create a virtual enviroment and activate it:
              $ virtualenv --python=python3.6 env_name
              $ source env_name/bin/activate
            
Install django:
              (env_name)$ pip install pip install Django==2.1.5
            
Install pillow and psycopg2:
              (env_name)$ pip install pillow psycopg2-binary
            
So, this is how most of the packages are installed. As you needed, install the other packages. Now start a django project named "myproject":
              (env_name)$ django-admin startproject myproject
            
It creates a project folder name "myproject" with a file "manage.py" and a folder "myproject". Now, let create first django app called "accounts". Also, create two folders, "templates" & "static". Inside static, create "css", "js" and "images as folder.
              (env_name)$ cd myproject
              (env_name)$ django-admin startapp accounts
            
Lets take a look at the directory structure:
  • project_dir
    • env_name
    • myproject
      • myproject
        • __init__.py
        • settings.py
        • urls.py
        • wsgi.py
      • manage.py
      • accounts
        • __init__.py
        • admin.py
        • apps.py
        • models.py
        • tests.py
        • views.py
      • templates
      • static
        • css
        • js
        • images
This is the basic initial setup I did before starting the real coding.

Coding Section Coming soon



For comments & suggestions, please feel free to contact me at riskyNumber@outlook.com