Skip to content Skip to sidebar Skip to footer

Issues In Initial Setup For Django Project

I am learning Django from the official documentation and while going through the tutorial at https://docs.djangoproject.com/en/1.7/intro/tutorial01/, I am stuck at creating a proje

Solution 1:

You can just run django-admin startproject mysite(Note: not django-admin.py), because if you install django by pip, a executable program named 'django-admin.exe' will be added to 'C:\Python34\Scripts', which is already in your environment variable 'PATH' normally(if not, add it to PATH).


Solution 2:

I was facing the same issue while installing Django 2.0.5. This can be resolved using Virtual Environments.


Environment details:

  • Python version: 3.6
  • OS: Ubuntu 18.xx.x

Steps:

  1. Install Virtual Environment pip install virtualenv
  2. Create a Virtual work-space('VEnv') virtualenv --python=python3 VEnv
  3. Activate the Virtual Environment: cd VEnv/ source bin/activate
  4. Install Django(Version - 2.0.5) pip install django==2.0.5
  5. Create Project (Project Name: HelloDot) django-admin startproject HelloDot
  6. Run the server as below and then access it from "http://127.0.0.1:8000/" cd HelloDot/ python manage.py runserver 8000

For more details, take a look at this: https://www.howtoforge.com/tutorial/how-to-install-django-on-ubuntu/


Solution 3:

Make sure that you follow the troubleshooting guide because it looks like you don't have django-admin.py on your system path correctly. From the docs:

django-admin.py should be on your system path if you installed Django via python setup.py. If it’s not on your path, you can find it in site-packages/django/bin, where site-packages is a directory within your Python installation. Consider symlinking to django-admin.py from some place on your path, such as /usr/local/bin.

You should also use a virtualenv for each of your projects to allow isolation of dependencies per project and easier management of them. virtualenvwrapper is a useful tool for creating and managing your virtualenvs.


Post a Comment for "Issues In Initial Setup For Django Project"