[Solved]-Django tutorial. from . import views

9👍

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.

4👍

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.

1👍

It means from the current directory import views.py module

👤Mohd

1👍

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

Leave a comment