[Django] 1. Configure

2024. 1. 25. 12:08dev/django

728x90
반응형

os : window.

 

install python and check version.

$ python -V

 

 

create virtual configuration setting

make directory.

$ mkdir venvs

 

 

make virtual configuration.

$ python -m venv mysite

 

 

and execute virtual config.

$ cd mysite/Scripts/
$ activate
bash: activate: command not found

 

but occur command not found -- activate cmd.

try this command.

$ source activate
(mysite)

 

 

disconnect cmd.

$ deactivate

 

 

create Django

download 'pip' new version

$ python -m pip install --upgrade pip

 

 

install django

$pip install django
# if you specify version $pip install django==4.x.x

 

 

make django projects!

move you want folder.

make projects folder.

$ mkdir projects

 

 

and execute virtual config.

$ source venvs/mysite/Scripts/activate
(mysite)

 

 

make owner folder(name:mysite)

$ cd projects
$ mkdir mysite

 

create django project

django-admin startproject

$ cd mysite/
$ django-admin startproject config .

 

 

if you order django-admin startproject mysite then create same name folders.

useful manage is other name, main folder and config for configuration app.

 

 

execute(run) server

$ python manage.py runserver
January 25, 2024 - 11:57:38
Django version 5.0.1, using settings 'config.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

 

 

 

simple enter virtual config mysite

path and filename : venvs/mysite.cmd

@echo off
cd D:
cd donguran/dev/django/projects/mysite
source donguran/dev/django/venvs/mysite/Scripts/activate

 

and register window config.

win + R cmd : sysdm.cpl

add at Path variable D:\donguran\dev\django\venvs

 

disconnect :

$deactivate
728x90
반응형

'dev > django' 카테고리의 다른 글

[Django] 6. Form  (0) 2024.01.25
[Django] 5. Template  (0) 2024.01.25
[Django] 4. Admin  (0) 2024.01.25
[Django] 3. Model  (0) 2024.01.25
[Django] 2. Basic  (0) 2024.01.25