Django: ViewDoesNotExist at/admin/Error 1. Add: "django. contrib. admin "to INSTALLED_APPS 2. Add:" from django. contrib import admin "to urls. py 3. Check: urls. in The py file, (R' ^ admin/$ ', include (admin. site. if the URLconf adopts the simple view mode, as follows: urlpatterns = patterns ('dapp1. views ', (R' ^ admin/$', include (admin. site. urls), # include (admin. site. (R' ^ admin/$ ', include (admin. site. urls) a huge mistake is that the path must be fixed in R' ^ admin/$ '. Start with admin. As a result, the path admin/book or admin/book cannot be interpreted. If the path is included in the address of another ulr, '$' is not required to end the match. Django: ImportError: Settings cannot be imported error: Execution in Python IDLE: failed to import Book model from app. books. models import Book, error message indicating environment variable not set. Because many environment variables need to be set when running Django, this step can be solved in two ways: Method 1: Run python manage in the window command interpreter. py shell. At this time, python has already set the Environment Variable Method 2: if it is not in the window command interpreter, but in the python IDLE, You need to manually set the Code as follows: >>> from django. conf import settings >>> from app. books. models import Book >>> settings. configure () >>> from app. books. in this way, the models import Book can be successfully imported from app. books. models import Book Django: django. db. integrityError 1. When a field is set to unique, duplicate values are inserted. 2. If this field is a foreign key, when a foreign key is inserted, however, this value is not stored in the associated table. For example, if a comment is inserted, the reviewer's id is used as the foreign key. When a comment is inserted, the Comment cannot be found in the user table, this error occurs. IOError: [Errno 13] Permission denied 1. Only the address is stored, instead of file_dir = 'users/static/images/user_face/'# file copy path douban_image = urllib. urlretrieve (image_url, file_dir) is: file_dir = 'users/static/images/user_face/'+ image_name # file copy path and file name