In this tutorial, you are going to create a Hackernews clone using Django and Graphene. The platform will have the following features:
Before starting, make sure you have Python 3.6 installed. If not, you can download it here. The installation is pretty straightforward on any supported operating system.
When working with Python, you will use Virtual Environment: a tool for keeping all the project’s dependencies isolated from your system – or other projects.
You’ll notice your prompt changed to (venv) ...
. It means you are inside your virtual environment, every Python package will be installed there. If you want to leave it, just type deactivate
. Make sure to always have the virtual environment activated.
The tool used to manage Python packages is pip
, which should be available with your Python installation.
Don’t worry about the hackernews/hackernews
structure, this is just the way Django works!
The commands above will install the necessary libraries, create a new Django project, create the base Django tables and start its builtin web server. To test it, open your browser and access the http://localhost:8000
address. You should see the following page: