[Solved]-Django tutorial. from . import views


The single dot is a convention from command line applications. It means the current directory. In terms of Django it stands for the directory/module the current file is on.


As others explained . refers to the current directory (or module / package) of the file that you are currently viewing.

The imports that use this syntax are called relative imports.

PEP 328 describes how relative imports came about and what specific syntax was chosen. The idea behind it was to use periods to determine how to relatively import other packages / modules. The reason was to prevent the accidental shadowing of standard library modules.


It means from the current directory import views.py module



while one dot means the current directory if you want upper dicrectory then use double dot just for your referencce

Leave a comment