First of all, I am a Django rookie, so pls get that.
I am trying to set up local enviroment, so I can run a web page locally on a VM.
But I am getting ImportError: No module named 'basic' in Python error, no matter if I'm trying to run as su or not.
Django version is 2.0.2 Python is 3.4.3
隐式相对导入在 Python 3 中不起作用。如果basic
在您的设置目录中,那么导入应该是:
from .basic import *
Just here to give my two cents. There are huge advantages of using Vagrant
. But since you just mentioned that you are a rookie. Can I interest you in virtual environment instead of virtual machine? It should get the work done as long as you are not doing something OS specific. Here's how it works:
$ mkdir project_name
$ cd project_name
$ python3 -m venv venv
$ source venv/bin/activate
$ django-admin startproject project_name
I also saw from your screenshot that you are logged in as root
. May I please suggest you to not do that as it is bad practice?
And I think your import has a problem as @Alasdair suggested. Try putting a dot .
in front of basic
, which suggests that you are targeting the basic
directory which resides in .
, the current directory.
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.