Skip to main content

Command Palette

Search for a command to run...

How to Run a DevOps To-Do App with GitHub, Python

Updated
6 min read
M

👋Hello I am Mohd Saif, passionate technology enthusiast currently pursuing a bachelor of Computer application degree.

🎓Education: I am currently pursuing a bachelor of Computer application degree with the focus on coding at Bareilly University my education journey has equipped me with strong foundation in Computer science and I am eager to apply my knowledge to real word challenges.

💡Passion for technology: I have always been deeply passionate about technology and I am particular drawn to devops with AWS.

🚀Skills: 🔹Linux 🔹Shell scripting 🔹Python 🔹Ansible 🔹Docker 🔹Kubernetes 🔹Jenkins CI/CD 🔹Maven 🔹Git and GitHub

✨Future goals: My goal is to facilitate seamless collaboration between development and operations teams, ensuring faster releases and high-quality software. I am a proactive learner, constantly exploring new DevOps trends and practices

Create a DevOps pipeline for a To-Do app project using GitHub and Python as depicted in your image. Here's a step-by-step guide:

DevOps To-Do App Project Using GitHub, Python

1. Setting Up the Django To-Do App

Prerequisites:

  • Python 3.x

  • A GitHub account

Step-by-Step Guide:

Step 1: Create the Django To-Do App
  1. Create a Virtual Environment:

     python3 -m venv venv
     source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    
  2. Install Django:

     pip install django
    
  3. Start a New Django Project:

     django-admin startproject todo_project
     cd todo_project
    
  4. Create the To-Do App:

     python manage.py startapp todo
    
  5. Set Up Models and Views: Define your data models in todo/models.py and create views in todo/views.py to handle displaying and managing to-do items.

  6. Configure URLs and Templates: Set up URL routing in todo/urls.py and create HTML templates in the templates directory to render your app’s UI.

  7. Create arequirements.txt File:

     pip freeze > requirements.txt
    
Step 2: Set Up GitHub Repository
  1. Initialize Git Repository:

     git init
    
  2. Create a.gitignore File:

     echo "venv/" >> .gitignore
     echo "*.pyc" >> .gitignore
     echo "__pycache__/" >> .gitignore
     echo "db.sqlite3" >> .gitignore
    
  3. Commit Changes:

     git add .
     git commit -m "Initial commit"
    
  4.  git clone https://github.com/shreys7/django-todo.git
     git push origin
     git branch -M main
     git push -u origin develop
    

Screenshot of Visual Studio Code showing a PowerShell terminal cloning a GitHub repository named "django-todo" with the URL https://github.com/shreys7/django-todo.git. The terminal indicates that the cloning and resolving process is complete. The left sidebar lists a folder named "django-todo" under "DEVOPS...". Various options and menus are visible in the interface, including the Start menu with options to create a new file, open a file, or open a folder.

Screenshot of a Visual Studio Code window showing a PowerShell terminal. Commands to create and activate a Python virtual environment are typed: "python -m venv myenv" and "virtualenv envythonctivate". The explorer on the left lists files and folders in a project named "DEVOPSPROJECT".

Screenshot of a Visual Studio Code window showing a PowerShell terminal. Commands to create and activate a Python virtual environment are typed: "python -m venv myenv" and "virtualenv env\python\activate". The explorer on the left lists files and folders in a project named "DEVOPSPROJECT".

Visual Studio Code (VS Code) window with the terminal open, showing commands and output related to a Django project. The terminal displays commands for navigating directories and installing Django dependencies, with messages indicating that these requirements are already satisfied. The sidebar reveals a project structure with folders and files like 'staticfiles', 'todoApp', 'todos', '.gitignore', 'db.sqlite3', 'LICENSE', and 'README.md'. Additionally, there is a notification that a new release of pip is available. The taskbar at the bottom shows several applications, including the Start menu, Edge, File Explorer, and others.

Visual Studio Code (VS Code) window with the terminal open, showing commands and output related to a Django project. The terminal displays commands for navigating directories and installing Django dependencies, with messages indicating that the requirements are already satisfied. The sidebar shows a project structure with folders and files such as 'staticfiles', 'todoApp', 'todos', '.gitignore', 'db.sqlite3', 'LICENSE', and 'README.md'. Additionally, there is a notification about a new release of pip. The taskbar at the bottom shows several applications, including the Start menu, Edge, File Explorer, and others.

A Visual Studio Code window displaying a Python project. The terminal shows a "makemigrations" command for a Django project, with a warning about auto-created primary keys. The file explorer and README.md file are visible in the editor.

Screenshot of a Visual Studio Code (VS Code) window displaying a README.md file for a Django project. The text guides users on how to set up the Django app, including running database migrations with the command , creating a superuser with , and starting the server with . The file explorer on the left lists project files, including directories and files like  and .

Screenshot of a Visual Studio Code (VS Code) window displaying a README.md file for a Django project. The text guides users on how to set up the Django app, including running database migrations with the command pythonmanage.pymigrate, creating a superuser with pythonmanage.pycreatesuperuser, and starting the server with pythonmanage.pyrunserver. The file explorer on the left lists project files, including directories and files like manage.py and README.md.

A screenshot of a Visual Studio Code window showing a terminal output for a Django project. The terminal displays the process of creating a superuser, including the operations performed, warnings, and user input for the username, email address, and password. The terminal confirms successful creation of the superuser. The application window includes various project files and folders on the left sidebar.

A screenshot of a Visual Studio Code window showing a terminal output for a Django project. The terminal displays the process of creating a superuser, including the operations performed, warnings, and user input for the username, email address, and password. The terminal confirms successful creation of the superuser. The application window includes various project files and folders on the left sidebar.

Screenshot of Visual Studio Code with a terminal window showing a Django development server startup command and warnings. The command  is highlighted, and a successful start message indicates the server running at . The workspace includes a README.md file with setup instructions.

Screenshot of Visual Studio Code with a terminal window showing a Django development server startup command and warnings. The command pythonmanage.pyrunserver is highlighted, and a successful start message indicates the server running at http://127.0.0.1:8000/. The workspace includes a README.md file with setup instructions.

Screenshot of a "Todo List" web application. The page shows a text input field with the placeholder text "hello connections" and an "Add" button next to it. Below, there are two listed tasks with checkboxes: "Send Resume Google now!" and "Hacktoberfest Updates," each with a delete icon on the right side. The URL in the browser is "127.0.0.1:8000/todos/".

Screenshot of a "Todo List" web application. The page shows a text input field with the placeholder text "hello connections" and an "Add" button next to it. Below, there are two listed tasks with checkboxes: "Send Resume Google now!" and "Hacktoberfest Updates," each with a delete icon on the right side. The URL in the browser is "127.0.0.1:8000/todos/".

Screenshot of a Visual Studio Code window focused on a terminal session. The terminal shows Git commands and an attempt to push changes, resulting in a permission error. The Explorer sidebar lists project files including "requirements.txt" which is open in the editor showing package versions like Django and virtualenv. A handwritten annotation points to the file with the text "Requirement.txt" and an arrow pointing to the terminal. The bottom taskbar of the screen shows various application icons and the date 7/14/2024.

We have run all these commands (pip freeze > requirements.txt, git checkout -b feature/deploy-app, git add ., git commit -m "added requirements") after running the todo application. This is the first part of our DevOps todo project. In the next part, we will deploy it on Docker and set up continuous integration with Jenkins. Stay tuned to learn more about this project.

Conclusion

In conclusion, this project demonstrates the effective use of Python and Django to create a functional "Todo List" web application. By following the setup instructions in the README.md file and using the provided GitHub repository, you can easily replicate and customize this project. The application allows users to add, delete, and manage tasks efficiently. With the help of Visual Studio Code, you can run the development server and make necessary changes to the project files. This project is a great starting point for anyone looking to learn more about web development with Python and Django.

More from this blog

Mohmmad Saif's blog

27 posts