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.
The next step is to create and activate the virtual environment for python language and your project.
$ mkdir django_001 $ cd django_001
Into this virtual environment named django_001_venv you will install django web framework.
$ python3 -m venv django_001_venv $ source django_001_venv/bin/activate
If you have problems with update pip then update this tool. Now start the django project named django_test.
pip install django
Open the url http://127.0.0.1:8000/ with your web browser.
$ django-admin startproject django_test $ cd django_test $ python3 manage.py runserver
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;
- settings.py - the configuration settings for the Django project;
- urls.py - contains URL patterns for the Django project;
- wsgi.py - is WSGI configuration properties for the Django project ( you don't need to setup WSGI to develop Django applications).
The next step is to create first django application.
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.
$ python manage.py startapp django_blog
Let's fix some issues about admin and the django_blog application.
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_blog', ]
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.