Django error set

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.