본문 바로가기

반응형

Django

(37)
secret key 생성 1. python manage.py shell 명령어를 이용하여 shell로 들어간다. 2. from django.core.management.utils import get_random_secret_key 를 입력한다. 3. get_random_secret_key() 를 이용하여 key를 만든다.
Django all-auth 로그인 연동 https://django-allauth.readthedocs.io/en/latest/installation.html Installation — django-allauth 0.43.0 documentation Post-Installation In your Django root execute the command below to create your database tables: Now start your server, visit your admin pages (e.g. http://localhost:8000/admin/) and follow these steps: Add a Site for your domain, matching settings.SITE_ID django-allauth.readthedoc..
Markdownx 사용하기 https://neutronx.github.io/django-markdownx/ Django Markdownx Django MarkdownX Django MarkdownX is a comprehensive Markdown plugin built for Django, the renowned high-level Python web framework, with flexibility, extensibility, and ease-of-use at its core. GitHub: https://github.com/neutronX/django-markdownx PyPi: ht neutronx.github.io 설치하기 $ pip install django-markdownx Collecting django-markdo..
Django-crispy-form을 설치하기 https://github.com/django-crispy-forms/crispy-bootstrap5 GitHub - django-crispy-forms/crispy-bootstrap5: Bootstrap5 template pack for django-crispy-forms Bootstrap5 template pack for django-crispy-forms. Contribute to django-crispy-forms/crispy-bootstrap5 development by creating an account on GitHub. github.com 폼의 디자인을 향상하기 위해 django-crispy -form을 사용할 수 있다. 설치하기 pip install django-crispy-forms s..
Python strip() https://docs.python.org/3.4/library/stdtypes.html?highlight=strip 4. Built-in Types — Python 3.4.10 documentation The following sections describe the standard types that are built into the interpreter. The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Some collection classes are mutable. The methods that add, subtract, docs.python.org strip functi..
Django Shell Plus 고급스러운 shell 사용하기 설치 $ pip install django_extensions Collecting django_extensions Downloading django_extensions-3.1.5-py3-none-any.whl (224 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 224.2/224.2 KB 4.6 MB/s eta 0:00:00 Requirement already satisfied: Django>=2.2 in ./venv/lib/python3.8/site-packages (from django_extensions) (4.0.2) Requirement already satisfied: sqlparse>=0.2.2 in ./venv/lib/pyt..
Compile Language & Interpreter Language 내가 익숙한 complie Language는 Java 언어 & Spring Framework 이다. 올해 계속 새로운 Language인 python & Django를 이용해서 사이트를 제작하는 중이다. Compile 언어는 Source 파일 내에서 순서가 중요하지 않았다. 왜냐하면 Compiler가 Source를 Compile 함으로써 실행을 위한 파일을 생성할 때 앞뒤를 잘 맞춰서 만들어주기 때문인다. 하지만 javascript 처럼 Python도 interpreter 언어이다. 그래서 파일 내에서의 순서가 중요하다. 아래와 같이 작성하면 Unresolved reference 'Category' 에러가 발생한다. from django.db import models # Create your models ..
Django 일부만 Test 하기 python manage.py test로 테스트 하면 App의 tests.py 파일내의 전체 test 소스가 test 된다. 이럴 땐 직접 method를 지정하여 Test를 실행 시키면 된다. python manage.py test blog.tests.TestView.test_post_list

반응형