python framework – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Sat, 20 Aug 2022 04:31:26 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How To Install Django on CentOS/RHEL 8 https://tecadmin.net/install-django-centos-8/ https://tecadmin.net/install-django-centos-8/#comments Fri, 14 Feb 2020 16:32:17 +0000 https://tecadmin.net/?p=19226 Django is a high-level Python Web framework for the rapid development of applications. It is developed by the Django Software Foundation in the year 2005. At the time of editing this tutorial, Django 3.0.3 is available for application development. This tutorial helps you to install and create a sample application with Django on CentOS 8 [...]

The post How To Install Django on CentOS/RHEL 8 appeared first on TecAdmin.

]]>
Django is a high-level Python Web framework for the rapid development of applications. It is developed by the Django Software Foundation in the year 2005. At the time of editing this tutorial, Django 3.0.3 is available for application development. This tutorial helps you to install and create a sample application with Django on CentOS 8 and RHEL 8 Linux systems.

Step 1 – Install Python

CentOS 8 minimal installation systems do not have default Python installed. You can install Python 3 on your CentOS 8 via default repository. Just execute the following commands to install Python and PIP on your system.

sudo dnf install python3 python3-pip

Then check the Python and pip version:

python3 -V

Python 3.6.8
pip3 -V

pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

Step 2 – Install Django on CentOS 8

Django source code is available in the Github repository. But this tutorial uses pip3 for the Django installation on CentOS 8 and RHEL 8 Linux. Simply run the following command from the system terminal:

pip3 install Django

You will get a django-admin command for creating new projects. Check the current installed verson:

django-admin --version

3.0.3

Step 3 – Create Django Application

You have Django installed on your system. Let’s create a new Django application. The django-admin command provides you the option to create a new Django application via command line. First, navigate to the directory you need to create a new application.

Then use the django-admin startproject command followed by the application name to create a new Django application on a Debian Linux.

cd /var/www
django-admin startproject django_app

After that migrate the pending changes.

cd django_app
python3 manage.py migrate

Step 4 – Create Admin User

Now, create a superuser account for the administration of the Django application. Run the following command from your Django application directory.

python3 manage.py createsuperuser

Step 5 – Run Django Application

A new Django application is ready to use. By default, Django doesn’t allow external hosts to access the web interface. To allow external hosts, edit settings.py file and add IP under ALLOWED_HOSTS.

vi django_app/settings.py

Add IP:

ALLOWED_HOSTS = ['192.168.1.239']

Here 192.168.1.239 is the IP address of the system where Django is installed.

Finally, run the Django application server with the below command. Here 0.0.0.0:8000 defined that Django will listen on all interfaces on port 8000. You can change this port with any of your choices.

python3 manage.py runserver 0.0.0.0:8000

running django on centos 8

Step 6 – Manage Firewalld

The system with an active firewall needs to open port to access Django over the network. Run the following commands to allow port 8000 for public users.

firewall-cmd --permanent --add-port=8000/tcp
firewall-cmd --reload

Step 7 – Access Django in Browser

The Django application server is running now. Open your favorite web browser and access to Django system IP on port 8000. This will show you the default Django web page.

http://192.168.1.239:8000

CentOS 8 install Django

Django also provides an administrative web interface. You can access this at /admin subdirectory URL of your Django application. Use superuser login credentials created in the previous step.

http://192.168.1.239:8000/admin

Installing django on CentOS 8

The Django admin dashboard looks like below. Here you can add more users and groups for your application.

Django Admin on CentOS 8

Conclusion

You have successfully installed Django and created a sample application on your CentOS 8 or RHEL 8 Linux system.

The post How To Install Django on CentOS/RHEL 8 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-django-centos-8/feed/ 1
How To Create Django Application on Fedora 36/35 https://tecadmin.net/install-django-on-fedora/ https://tecadmin.net/install-django-on-fedora/#comments Fri, 30 Aug 2019 12:16:06 +0000 https://tecadmin.net/?p=19222 Have you been itching to get your hands on the latest versions of Django, but haven’t found an easy way to do it on Fedora? You aren’t alone! We know that there are tons of new users who are interested in technology like Django, and we want to help them get set up quickly with [...]

The post How To Create Django Application on Fedora 36/35 appeared first on TecAdmin.

]]>
Have you been itching to get your hands on the latest versions of Django, but haven’t found an easy way to do it on Fedora? You aren’t alone! We know that there are tons of new users who are interested in technology like Django, and we want to help them get set up quickly with the software they need.

This blog post will walk you through how to get started with your local testing environment for Django on Fedora.

Prerequisites: Basic knowledge of using a Linux terminal/command line and installation of software packages.
Objective: To setup the development environment for Django on Fedora

Step 1 – Installing Python

First, let’s make sure you have the latest versions of Python and Django installed. Open a terminal window, and start by updating your system:

sudo apt update && apt upgrade 

Fedora’s latest versions have already installed Python 3. The minimal installation systems may not have Python installed, Execute the below commands to install it. Also, install pip on your system.

sudo dnf install python3 python3-pip 

Once the installation is finished successfully, you can find the Python version with the python3 -V command.

Step 2 – Install Django on Fedora

Django source code is available as a Github repository. This tutorial uses pip3 for the Django installation on Fedora Linux. Simply execute the following command from the terminal:

pip3 install Django 

You will get a django-admin command, that is used to initialize new Django applications. To find the version of the django-admin command, type:

django-admin --version 

2.2.5

Step 3 – Create a New Django Application

Django has been installed on your system. Now we will create a new Django application. The django-admin command allows you to create a new Django application via the command line. First, navigate to the directory you need to create a new application.

Then use the django-admin startproject command followed by the application name to create a new Django application on Debian Linux.

cd /var/www 
django-admin startproject django_app 

This will create a django_app directory. Switch to that directory and run the migrations for the first time:

cd django_app 
python3 manage.py migrate 

Step 4 – Create Super Admin Account

Django provides a super admin panel for administering it. You need to create a super user account for the first time. Run the following command from your Django application to create an account.

python3 manage.py createsuperuser 

Setup django on Fedora

Step 5 – Run Django Application

A new Django application is ready to use. By default, Django doesn’t allow external hosts to access the web interface. To enable external hosts, edit the settings.py file and add IP under ALLOWED_HOSTS.

nano django_app/settings.py 

Add IP:

ALLOWED_HOSTS = ['192.168.1.239']

Here 192.168.1.239 is the IP address of the system where Django is installed.

Finally, run the Django application server with the below command. Here 0.0.0.0:8000 defined that Django will listen on all interfaces on port 8000. You can change this port with any of your choices.

python3 manage.py runserver 0.0.0.0:8000 

how to setup django on fedora

The Django application server is running now. Open your favorite web browser and access to Django system IP on port 8000. This will show you the default Django web page.

http://192.168.1.239:8000

Configure Django on Fedora

Django also provides an administrative web interface. You can access this at /admin subdirectory URL of your Django application. Use superuser login credentials created in the previous step.

http://192.168.1.239:8000/admin

Installing django on Fedora

The Django admin dashboard looks like the below. Here you can add more users and groups to your application.

Django Setup on Fedora

Conclusion

Django is one of the most popular frameworks for web development, and it’s easy to get started using it with Fedora. To get started, make sure you have the latest versions of Python and Django installed. Next, create a virtual environment for testing, and you can use the Live-reload Django app to make testing more efficient. Once you’re set-up, you can start building your next Django project. Now that you know how to get your own local testing environment set up, you can create your next Django project with ease.

The post How To Create Django Application on Fedora 36/35 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-django-on-fedora/feed/ 1
How to Install Django on Ubuntu 18.04 & 16.04 LTS https://tecadmin.net/install-django-on-ubuntu/ https://tecadmin.net/install-django-on-ubuntu/#comments Sun, 07 Oct 2018 05:26:51 +0000 https://tecadmin.net/?p=17000 Django is a Python Web framework that encourages rapid development of applications. The Django framework is designed for developers to take applications from initial to completion as quickly as possible. It provides higher security for the application and avoids developers for making common security mistakes. This tutorial helps you to install Django on Ubuntu 18.04 [...]

The post How to Install Django on Ubuntu 18.04 & 16.04 LTS appeared first on TecAdmin.

]]>
Django is a Python Web framework that encourages rapid development of applications. The Django framework is designed for developers to take applications from initial to completion as quickly as possible. It provides higher security for the application and avoids developers for making common security mistakes.

This tutorial helps you to install Django on Ubuntu 18.04 & 16.04 LTS. Also, create your first Django application. Let’s Follow tutorial:

Step 1 – Install Python and PIP

Most of the latest operating systems come with default Python 3 installed. But if your system doesn’t have Python installed, Execute the below commands to install it. Also, install pip on your system.

sudo apt-get install python3 python3-pip

The installed Python version is:

python3 -V

Python 3.5.3

and pip version is:

pip3 -V

pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)

Step 2 – Install Django on Ubuntu

Django source code is available as Github repository. You can also use pip to install Django on Ubuntu 18.04 systems. In this tutorial, I use pip3 for the Django installation on Ubuntu. Run the below command from Linux terminal:

pip3 install Django

You will get a django-admin command for creating new projects. Check the current installed verson:

django-admin --version

2.1.2

Step 3 – Create A Django Application

The django-admin command provides you option to create a new Django application via command line. First, navigate to the directory you need to create a new application.

Then use django-admin startproject command followed by the application name to create new Django application

cd /var/www
django-admin startproject django_app

After that migrate the pending changes.

cd django_app
python3 manage.py migrate

Step 4 – Create Super User

Also, create a superuser account for the administration of the Django application. Run the following command from your Django application directory.

python3 manage.py createsuperuser

Step 5 – Run Django Application

Your Django application is ready to use. By default, Django doesn’t allow external hosts to access the web interface. To allow external hosts, edit settings.py file and add IP under ALLOWED_HOSTS.

vi django_app/settings.py

Add IP:

ALLOWED_HOSTS = ['192.168.1.239']

Here 192.168.1.239 is the IP address of the system where Django is installed.

Finally, run the Django application server with below command. Here 0.0.0.0:8000 defined that Django will listen on all interfaces on port 8000. You can change this port with any of your choices.

python3 manage.py runserver 0.0.0.0:8000

Django application server is running now. Open your favorite web browser and access to Django system ip on port 8000. This will show you the default Django web page.

http://192.168.1.239:8000

Django also provides an administrative web interface. You can access this at /admin subdirectory URL of your Django application. Use superuser login credentials created in the previous step.

http://192.168.1.239:8000/admin

The Django admin dashboard looks like below. Here you can add more users and groups for your application.

The post How to Install Django on Ubuntu 18.04 & 16.04 LTS appeared first on TecAdmin.

]]>
https://tecadmin.net/install-django-on-ubuntu/feed/ 9
How to Install Django on Debian Linux https://tecadmin.net/install-django-on-debian/ https://tecadmin.net/install-django-on-debian/#comments Wed, 03 Oct 2018 14:39:25 +0000 https://tecadmin.net/?p=17064 Django is a Python Web framework that encourages rapid development of applications. This tutorial helps you to install Django on Debian 10 Buster, Debian 9 Stretch system. After that create and run your first Django applications. Step 1 – Prerequsities The latest versions of operating systems come with default Python 3 installed. The minimal installation [...]

The post How to Install Django on Debian Linux appeared first on TecAdmin.

]]>
Django is a Python Web framework that encourages rapid development of applications. This tutorial helps you to install Django on Debian 10 Buster, Debian 9 Stretch system. After that create and run your first Django applications.

Step 1 – Prerequsities

The latest versions of operating systems come with default Python 3 installed. The minimal installation systems may not have Python installed, Execute the below commands to install it. Also, install pip on your system.

sudo apt-get install python3 python3-pip

Then check the Python and pip version:

python3 -V

Python 3.5.3
pip3 -V

pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)

Step 2 – Install Django on Debian

Django source code is available as a Github repository. You can also use pip to install Django on Debian 9 systems. In this tutorial, I use pip3 for the Django installation on Ubuntu. Run the below command from Linux terminal:

pip3 install Django

You will get a django-admin command for creating new projects. Check the current installed verson:

django-admin --version

2.1.2

Step 3 – Create Django Application

The django-admin command provides you the option to create a new Django application via command line. First, navigate to the directory you need to create a new application.

Then use the django-admin startproject command followed by the application name to create a new Django application on a Debian Linux.

cd /var/www
django-admin startproject django_app

After that migrate the pending changes.

cd django_app
python3 manage.py migrate

Django on Debian

Step 4 – Create Super Admin Account

Also, create a superuser account for the administration of the Django application. Run the following command from your Django application directory.

python3 manage.py createsuperuser

Django create user on Debian

Make sure all the migrations completed successfully. Once done, go to the next step.

Step 5 – Run Django Application

Your Django application is ready to use. By default, Django doesn’t allow external hosts to access the web interface. To allow external hosts, edit settings.py file and add IP under ALLOWED_HOSTS.

vi django_app/settings.py

Add IP:

ALLOWED_HOSTS = ['192.168.1.239']

Here 192.168.1.239 is the IP address of the system where Django is installed.

Finally, run the Django application server with the below command. Here 0.0.0.0:8000 defined that Django will listen on all interfaces on port 8000. You can change this port with any of your choices.

python3 manage.py runserver 0.0.0.0:8000

Run Django on Debian

The Django application server is running now. Open your favorite web browser and access to Django system IP on port 8000. This will show you the default Django web page.

http://192.168.1.239:8000

Django Setup on Debian

Django also provides an administrative web interface. You can access this at /admin subdirectory URL of your Django application. Use superuser login credentials created in the previous step.

http://192.168.1.239:8000/admin

Debian Dejango Admin

The Django admin dashboard looks like below. Here you can add more users and groups for your application.

Django on Debian

The post How to Install Django on Debian Linux appeared first on TecAdmin.

]]>
https://tecadmin.net/install-django-on-debian/feed/ 5