βœ… How to Upload Your Django Project to GitHub:- πŸ”§ 1. Make Sure Your Django Project Is Ready Your Django project folder should look something like this: myproject/ β”œβ”€β”€ manage.py β”œβ”€β”€ myproject/ # settings.py lives here β”‚ └── settings.py β”œβ”€β”€ myapp/ # your Django app β”œβ”€β”€ templates/ β”œβ”€β”€ static/ β”œβ”€β”€ db.sqlite3 β”œβ”€β”€ requirements.txt └── .gitignore πŸ“¦ 2. Create a Virtual Environment and Freeze Dependencies Activate your environment (if not already): # If you haven’t created it yet python -m venv env env\Scripts\activate # Windows # or source env/bin/activate # Mac/Linux # Install Django if needed pip install django # Freeze your dependencies pip freeze > requirements.txt 🚫 3. Create a .gitignore File Make sure sensitive files like the virtual environment, database, and cache are ignored. Create a .gitignore in the project root and add: # Python *.pyc __pycache__/ # Env env/ # Django db.sqlite3 /staticfiles/ *.log # VSCode or PyCharm .vscode/ .idea/ βœ… 4. Initialize a Git Repository git init git add . git commit -m "Initial commit - Django project" 🌐 5. Create a New Repository on GitHub Go to: https://github.com/new Enter a repository name (e.g., my-django-project) Do not check "Initialize with README" (you're pushing your own files) Click Create repository ⬆️ 6. Push Your Django Project to GitHub Use the URL GitHub gives you (replace your username and repo name): git remote add origin https://github.com//.git git branch -M main git push -u origin main βœ… That’s it! Your Django project is now on GitHub. 🧩 7. Optional Good Practices Commit regularly with messages like: git add . git commit -m "Added login page" git push Add a README.md to describe your project. Add a LICENSE if you're planning to share it publicly. Based on your GitHub repository URL: https://github.com/digitalommaurya/my-django-project You should run the following commands exactly as written below to push your local Django project to GitHub: βœ… Git Commands (Updated for Your Repo) git remote add origin https://github.com/digitalommaurya/my-django-project.git git branch -M main git push -u origin main βœ… What This Does: git remote add origin ... β†’ Connects your local project to your GitHub repo. git branch -M main β†’ Renames your current branch to main (if it's not already). git push -u origin main β†’ Pushes your code to the main branch of the remote repo and sets it as the default upstream. βœ… Make sure you’ve already done git init, git add ., and git commit -m "message" before running these commands.