django project in ubuntu

  1. Install Python and pip:
  2. Open the terminal and run the following command to install Python: sudo apt-get install python3
  3. Then, install pip using the command: sudo apt-get install python3-pip

  4. Create a virtual environment:

  5. Run the command: python3 -m venv myenv
  6. Activate the virtual environment using: source myenv/bin/activate

  7. Install Django:

  8. Use pip to install Django: pip install django

  9. Create a new Django project:

  10. Run the command: django-admin startproject myproject

  11. Navigate into the project directory:

  12. Use: cd myproject

  13. Start the development server:

  14. Run the command: python manage.py runserver

  15. Open a web browser and access the development server:

  16. Visit http://localhost:8000 in your browser

  17. Create a new Django app within the project:

  18. Use: python manage.py startapp myapp

  19. Update the settings.py file:

  20. Open the file myproject/settings.py and add 'myapp', to the INSTALLED_APPS list.

  21. Create database tables:

    • Run the command: python manage.py migrate
  22. Create a Django superuser:

    • Use: python manage.py createsuperuser
  23. Start building your Django app:

    • Open the myapp directory and start creating models, views, and templates according to your project requirements.
  24. Configure URL routing:

    • Open the myproject/urls.py file and add URL patterns to map the views you created in your app.
  25. Run the development server again:

    • Use: python manage.py runserver
  26. Test your Django app:

    • Open a web browser and visit http://localhost:8000 to see your Django app in action.
  27. Continue developing your Django app by adding more functionality and features as needed.

Note: Make sure to refer to the official Django documentation for more detailed explanations and additional configuration options.