บทความ

กำลังแสดงโพสต์จาก มกราคม, 2021

pypi.org

https://dzone.com/articles/executable-package-pip-install https://stackpython.medium.com/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%99%E0%B8%B3-package-%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%80%E0%B8%A3%E0%B8%B2%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87%E0%B8%AD%E0%B8%B1%E0%B8%9E%E0%B8%A5%E0%B8%87-pypi-%E0%B8%AB%E0%B8%A3%E0%B8%B7%E0%B8%AD-pip-%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B8%84%E0%B8%99%E0%B8%AD%E0%B8%B7%E0%B9%88%E0%B8%99%E0%B9%82%E0%B8%AB%E0%B8%A5%E0%B8%94%E0%B9%84%E0%B8%94%E0%B9%89-726a80ef51b8 https://betterscientificsoftware.github.io/python-for-hpc/tutorials/python-pypi-packaging/  https://pypi.org/project/Django-Basic-CRUD-Generator/

ตัวอย่างที่น่าสนใจ

  Create the Model | Ultimate Django Django CRUD Application - javatpoint django.utils datetime_safe Example Code - Full Stack Python Simple Excel Parsing to Database in Django with Pyexcel-xls and Pyexcel-xlsx | by 9cv9 official | Medium List of Useful URL Patterns (simpleisbetterthancomplex.com) django-admin - Add a Model to Admin pages | django-admin Tutorial (riptutorial.com) https://gitlab.com/burke-software/django-report-builder

Django Models

Python manage.py makemigrations Python manage.py migrate python manage.py migrate --run-syncdb Listing 7-12. Django model with custom save() method class Store(models.Model): name = models.CharField(max_length=30) address = models.CharField(max_length=30) city = models.CharField(max_length=30) state = models.CharField(max_length=2) def save(self, *args, **kwargs): # Do custom logic here (e.g. validation, logging, call third party service) # Run default save() method super(Store,self).save(*args, **kwargs)

Django บน Python ตั้งค่าให้รองรับภาษาไทยและโซนเวลาไทย

  เข้าไปแก้ไขที่ไฟล์ settings.py แก้ไขตรง  LANGUAGE_CODE = 'en-us' เปลี่ยนเป็น LANGUAGE_CODE = 'th-th' แก้ไขโซนเวลาให้เป็นเวลาของไทย ให้ค้นหา TIME_ZONE = 'America/Chicago' แล้วเปลี่ยนเป็น TIME_ZONE = 'Asia/Bangkok' แล้วบันทึกไฟล์

การนำ Package ที่เราสร้างอัพลง PyPI หรือ pipให้คนอื่นโหลดได้

 https://stackpython.medium.com/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%99%E0%B8%B3-package-%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%80%E0%B8%A3%E0%B8%B2%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87%E0%B8%AD%E0%B8%B1%E0%B8%9E%E0%B8%A5%E0%B8%87-pypi-%E0%B8%AB%E0%B8%A3%E0%B8%B7%E0%B8%AD-pip-%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B8%84%E0%B8%99%E0%B8%AD%E0%B8%B7%E0%B9%88%E0%B8%99%E0%B9%82%E0%B8%AB%E0%B8%A5%E0%B8%94%E0%B9%84%E0%B8%94%E0%B9%89-726a80ef51b8

Visual Studio Code

รูปภาพ
Visual Studio Code indent-rainbow - Visual Studio Marketplace Visual Studio Code: Multi-line and multi-cursor editing | Ken Cenerelli (wordpress.com) edit multiple lines vscode Code Example (codegrepper.com)

django view.py

 https://www.django-rest-framework.org/api-guide/routers/ return render ( request , 'index.html' ,  {'paraname':'ทดสอบส่งไปใน html'} )

Dropdown List with Django

  How to Implement Dependent/Chained Dropdown List with Django (simpleisbetterthancomplex.com)

chocolatey.org

 chocolatey.org

python MySQL HOSxP

Python Extension Packages for Windows - Christoph Gohlke (uci.edu) install mysql client python 3.9 pip install   mysqlclient‑1.4.6‑cp39‑cp39‑win_amd64.whl =================================================================  #myapp/settings/settings.py DATABASES = {     'default': {         'ENGINE': 'django.db.backends.mysql',         'NAME': 'HOS',         'USER': 'sa',         'PASSWORD': 'sa',         'HOST': 'localhost',   # Or an IP Address that your database is hosted on         'PORT': '3306',         #optional:         'OPTIONS': {                      charset='utf8',                       init_command='SET NAMES UTF8'         }, } แบบนี้ใช้ได้ DATABASES  =...

Python Windows 10

Python Path to Windows 10 PATH https://www.liquidweb.com/kb/how-do-i-set-system-variable-path-for-python-on-windows/ Installing Pip  on Windows https://www.liquidweb.com/kb/install-pip-windows/ Upgrading Pip python -m pip install --upgrade pip Downgrading Pip python -m pip install pip==18.0 Install Python Packages Requirements Python When installing a package, we must first ensure that  Python  is installed on the system. We can verify this by running the following command in a terminal. root@host [~]# python --version Pip Pip is the default package manager for python. It is used to install and manage python software from the command line. root@host [~]# python -m pip --version pip 19.3.1 from /usr/lib/python2.7/site-packages/pip (python 2.7) root@host [~]# python -m ensurepip --default-pip PyPi PyPi or the “ Py thon  P ackage  I ndex” is a software repository that contains applications used by the python programming language. PyPi supports installing software ...

python virtualenv.

https://sourabhbajaj.com/mac-setup/Python/virtualenv.html Python Virtual Environments (uoa-eresearch.github.io) Step 3. Install Virtualenv  In your Windows command shell prompt type in: pip install virtualenv Start virtualenv  In your windows command prompt, head to your project location:  cd my_project  Once inside the project folder run:  virtualenv env Activate virtualenv  On Windows, virtualenv (venv) creates a batch file called  \env\Scripts\activate.bat To activate virtualenv on Windows, and activate the script is in the Scripts folder : \pathto\env\Scripts\activate Example:  C:\Users\'Username'\venv\Scripts\activate.bat Step 4. Install VirtualEnvWrapper-win  There are two main methods we recommend to install this batch script. Using pip pip install virtualenvwrapper-win Install from source git clone git://github.com/davidmarble/virtualenvwrapper-win.git We then cd to the virtualenvwrapper-win folder and run:  python setup.py inst...