I am trying to create a project in a virtual environment in Ubuntu 16.04
I am using Python 3.6
What I do so far is
sudo bash
cd Desktop/DamLevels-course2/Damlevels2/
source venv2/bin/activate
django-admin.py startproject dams
The error says: ImportError: No module named 'secrets'
I have checked the list of modules in python and secrets is there, but when I try to import to the virtual environment I get an error saying: import: not authorized 'secrets' @ error/constitute.c/WriteImage/1028
I tried adding the shebang line as well (#;/usr/bin/env) but that didn't seem to work. running the startproject line again results in the same error message as before.
I am very new to all of this, so I would appreciate fairly simple help.
Ok I think I got it to work. Instead of using
django-admin.py startproject *name*
i used
django-admin startproject *name*
First I had to install python-django
Thanks for your help everyone!
The Django documentation states the command to create a new project is:
$ django-admin startproject mysite
So to create your project replace "mysite" with "dams", or whatever your project name will be. For example:
$ django-admin startproject dams
Also, perhaps it was a typo but the package that should be installed is "python3-django", not "python-django". This command will install python3-django.
$ sudo apt-get install python3-django
The Django documentation also references potential problems running django-admin . Here is an excerpt mentioning issues between django-admin and django-admin.py.
Problems running django-admin
command not found: django-admin
django-admin should be on your system path if you installed Django via pip. 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 from some place on your path, such as /usr/local/bin.
If django-admin doesn't work but django-admin.py does, you're probably using a version of Django that doesn't match the version of this documentation. django-admin is new in Django 1.7.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.