Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Django syntax
#1
So I'm getting used to the Django framework and sort of bouncing from videos/books. No two materials seem to use the same syntax. I'm trying to understand why I'm typing what I am into the terminal instead of just typing (ie django-admin.py manage.py migrate before python3 manage.py run server ...I want to understand why it's django-admin.py in one area and python3 in the another). So I have a question. The following works on local host.

So mainly what is the difference between these two "styles"? (I don't have a better word).
Also The first example tells me that I must use (dot) when starting project. The second example ignores it...

Can anyone PLEASE run through these quickly? they both work in my browser...but I just want to understand...

[inline]me@me-ubuntu:~/Desktop$ mkdir foo
me@me-ubuntu:~/Desktop$ cd foo
me@me-ubuntu:~/Desktop/foo$ python3 -m venv foo_env
me@me-ubuntu:~/Desktop/foo$ source foo_env/bin/activate
(foo_env) me@me-ubuntu:~/Desktop/foo$ pip3 install Django
--SNIP--
(foo_env) me@me-ubuntu:~/Desktop/foo$ django-admin.py startproject foo .
(foo_env) me@me-ubuntu:~/Desktop/foo$ python3 manage.py migrate
--SNIP--
(foo_env) me@me-ubuntu:~/Desktop/foo$ python3 manage.py runserver
Performing system checks...
--SNIP--
Quit the server with CONTROL-C.
[/inline]

ANOTHER STYLE
[inline]me@me-ubuntu:~/Desktop$ mkdir foo
me@me-ubuntu:~/Desktop$ cd foo
me@me-ubuntu:~/Desktop/foo$ virtualenv foo #this part here is different with VIRTUALENV
Using base prefix '/usr'
New python executable in /home/me/Desktop/foo/foo/bin/python3
Also creating executable in /home/me/Desktop/foo/foo/bin/python
Installing setuptools, pip, wheel...done.
me@me-ubuntu:~/Desktop/foo$ cd foo
me@me-ubuntu:~/Desktop/foo/foo$ source bin/activate #this is also different involving wheels (~tarballs?)
(foo) me@me-ubuntu:~/Desktop/foo/foo$ pip3 install django
--SNIP--
(foo) me@me-ubuntu:~/Desktop/foo/foo$ django-admin startproject foo #no \s dot ? why?
(foo) me@me-ubuntu:~/Desktop/foo/foo$ cd foo
(foo) me@me-ubuntu:~/Desktop/foo/foo/foo$ python3 manage.py migrate
--SNIP--
(foo) me@me-ubuntu:~/Desktop/foo/foo/foo$ python3 manage.py runserver
--SNIP--
[/inline]
Reply


Messages In This Thread
Django syntax - by mepyyeti - Jan-17-2018, 06:14 AM
RE: Django syntax - by knackwurstbagel - Feb-16-2018, 03:55 AM
RE: Django syntax - by Drone4four - Feb-16-2018, 05:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,354 Jun-30-2019, 12:21 AM
Last Post: scidam
  Question about dot notation syntax (Django source) Drone4four 3 4,116 Feb-25-2018, 02:42 AM
Last Post: knackwurstbagel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020