반응형
반응형

터미널에서 장고 프로젝트 디렉토리인 mysite 로 이동 합니다.

(.conda) (c:\dev\django\.conda) C:\dev\django>cd mysite

터미널에서 mysite 디렉터리로 이동 후 python manage.py runserver 라는 명령어를 실행합니다.

(.conda) (c:\dev\django\.conda) C:\dev\django\mysite>python manage.py runserver

서버가 정상적으로 실행되었다면 웹브라우저를 이용하여 http://127.0.0.1:8000/ 에 접속합니다.

 

http://127.0.0.1:8000/

 

문서 :   https://docs.djangoproject.com/en/5.1/  

 

 
반응형
반응형

터미널에서 장고 프로젝트 디렉토리인 mysite 로 이동 합니다.

(.conda) (c:\dev\django\.conda) C:\dev\django>cd mysite

터미널에서 python manage.py makemigrations 라는 명령어를 실행합니다.

(.conda) (c:\dev\django\.conda) C:\dev\django\mysite>python manage.py makemigrations

터미널에서 python manage.py migrate 라는 명령어를 실행합니다.

(.conda) (c:\dev\django\.conda) C:\dev\django\mysite>python manage.py migrate



 

반응형
반응형

[python] Django  설치,  프로젝트 생성

 

 

django-admin 명령어를 실행하려고 했을 때 시스템이 해당 명령어를 찾지 못하는 경우 발생합니다. 일반적으로 Django가 설치되어 있지 않거나, 설치 경로가 시스템의 환경 변수에 추가되지 않은 경우입니다.

해결 방법

1. Django가 설치되어 있는지 확인

  • 다음 명령어로 Django가 설치되어 있는지 확인합니다:
     
    pip show django
    • Django 버전과 경로가 출력되면 설치가 되어 있는 상태입니다.
    • 아무 내용도 출력되지 않으면 Django가 설치되지 않은 상태입니다. 이 경우, 다음 명령어로 설치하세요:
       
      pip install django

2. django-admin 명령어를 전체 경로로 실행

  • 가상환경 또는 시스템 경로 문제로 인해 django-admin이 실행되지 않을 수 있습니다. 전체 경로로 실행해보세요:
     
    python -m django --version
    또는
     
    python -m django startproject myproject

3. PATH 환경 변수 확인

  • django-admin 명령어가 시스템의 환경 변수 PATH에 등록되지 않았을 가능성이 있습니다.
  • Django 명령어가 있는 경로를 확인합니다:
     
    where django-admin
    또는
     
    where django-admin.exe
    • 경로가 출력되면, 해당 경로를 확인하고 PATH에 추가해야 할 수 있습니다.
    • 경로가 출력되지 않으면 Django가 설치되지 않았거나, 가상환경을 활성화하지 않은 상태일 수 있습니다.

4. 가상환경 활성화

  • 가상환경을 사용하는 경우, 먼저 활성화해야 Django 명령어를 사용할 수 있습니다.
    • Windows:
       
      .\venv\Scripts\activate
    • macOS/Linux:
       
      source venv/bin/activate
  • 활성화 후 다시 django-admin 명령어를 실행합니다:
    •  django-admin startproject myproject

5. Django 명령어를 실행할 Python 버전 확인

  • 시스템에 Python 2와 Python 3이 함께 설치되어 있는 경우, django-admin 명령어가 제대로 연결되지 않을 수 있습니다.
  • Python 3로 명시적으로 실행해보세요:
     
    python3 -m django startproject myproject

예시: 새 프로젝트 시작하기

  1. 가상환경 생성 및 활성화:
  2.  
    python -m venv venv source venv/bin/activate # Windows는 venv\Scripts\activate
  3. Django 설치:
  4.  
    pip install django
  5. 새 프로젝트 생성:
  6.  
    django-admin startproject myproject

여전히 문제를 해결하지 못한 경우

  1. Python 및 Django 설치 상태를 확인하세요:
     
    python --version pip show django
     
     
     
     

반응형
반응형

[python] Django 설치

 conda create -n p_django python=3.11

 

 

Django 설치 확인

 python -m django --version

반응형
반응형

djangorestframework 3.14.0

 

 

https://www.django-rest-framework.org/

 


*** 참고 : https://towardsdatascience.com/designing-and-deploying-a-machine-learning-python-application-part-2-99eb37787b2b

https://pypi.org/project/djangorestframework/

pip install djangorestframework

Requirements Python 3.6+ Django 4.1, 4.0, 3.2, 3.1, 3.0 We highly recommend and only officially support the latest patch release of each Python and Django series.

Installation Install using pip...

pip install djangorestframework
Add 'rest_framework' to your INSTALLED_APPS setting.

INSTALLED_APPS = [
    ...
    'rest_framework',
]

 

Designing and Deploying a Machine Learning Python Application (Part 2)

You don’t have to be Atlas to get your model into the cloud

towardsdatascience.com

 

 

 

 

 

반응형
반응형

React와 Django로 웹 서비스 뚝딱 세팅하기 (feat. Webpack, Redux, django rest framework, PWA)

http://milooy.github.io/TIL/Django/react-with-django-rest-framework.html#%E1%84%86%E1%85%A9%E1%86%A8%E1%84%91%E1%85%AD

 

[서버부터 프론트까지] React와 Django로 웹 서비스 뚝딱 세팅하기 (feat. Webpack, Redux, django rest framework

[서버부터 프론트까지] React와 Django로 웹 서비스 뚝딱 세팅하기 (feat. Webpack, Redux, django rest framework, PWA) 목표 모임 개설 사이트, 'MOGAE' 제작. Django에 Django Rest Framework를 얹어 API 서버를, react로 프론

milooy.github.io

목표

모임 개설 사이트, 'MOGAE' 제작. Django에 Django Rest Framework를 얹어 API 서버를, react로 프론트엔드를 개발합니다. 상태관리는 redux로 하며 Progressive Web App기술을 적용해 앱처럼 사용할 수 있습니다.

이를 연동하여 온전한 웹 어플리케이션을 만드는 것에 초점을 맞춘 튜토리얼입니다. (기술에 대한 설명은 하지 않습니다.)

#사용 버전

  • Python: 3.4.3
  • Django: 1.11.3
  • Django Rest Framework: 3.6.3

장고걸스 : https://tutorial.djangogirls.org/ko/django_installation/

 

Django 설치하기 · HonKit

virtualenv를 생성하려면 콘솔 창을 열고, (이전 장에서 얘기했는데, 기억나죠?) 그리고 C:\Python35\python -m venv myvenv를 실행하세요. 아마도 화면에 이렇게 보일 거에요. : command-line C:\Users\Name\djangogirls>

tutorial.djangogirls.org

https://gitter.im/DjangoGirls/tutorial

 

DjangoGirls/tutorial

This is a tutorial we are using for Django Girls workshops

gitter.im

 

@ Django 자습 : https://wikidocs.net/book/837

 

Django 자습

Django 자습, 요약, 정리 # 출처 ## 참고 서적 * Django로 배우는 쉽고 빠른 웹 개발 - 파이썬 웹 프로그래밍 * Django를 활용한 쉽고 빠른 웹 …

wikidocs.net

 

반응형

+ Recent posts