Saturday, March 17, 2018

Today I tested the Django web framework version 2.0.3 with python 3 on my Fedora 27 distro.
The main reason is to see if the Django and Fedora working well.
I used the pip to install and activate the virtual environment for python.
First you need to create your project into your folder.
I make one folder named django_001.

$ mkdir django_001
$ cd django_001

The next step is to create and activate the virtual environment for python language and your project.

Open the url http://127.0.0.1:8000/ with your web browser.
The result is this:
If you try to use the admin web with password and user you will see errors.
One of the most common problem for django come from settings, let's see some file from the project:

manage.py - this runs project specific tasks (the django-admin is used to execute system wide Django tasks) and is used to execute project specific tasks;

__init__.py - this file that allows Python packages to be imported from directories where it's present and it's a generic file used in almost all Python applications;

This make a folder named django_blog into the main django_test folder.
Into the main django_test folder you have another django_test folder with settings.py file.
Add into settings.py file the django_blog application.

Let's fix some issues about admin and the django_blog application.
Into the main django_test folder with manage.py file use this:

$ python3 manage.py migrate
$ python3 manage.py createsuperuser

This fix the django framework and let you to add your superuser using the admin page, see:
The next issue is: create the website ( see the django_blog folder) using the Django web framework.
I don't have a issue for this django_blog but you can follow this tutorial link.