api.winerva.com
Open in
urlscan Pro
203.204.232.62
Public Scan
URL:
https://api.winerva.com/
Submission: On March 06 via api from US — Scanned from US
Submission: On March 06 via api from US — Scanned from US
Form analysis
1 forms found in the DOMGET https://blog.winerva.com/
<form role="search" method="get" id="searchform" class="searchform" action="https://blog.winerva.com/">
<div>
<label class="screen-reader-text" for="s">搜尋關鍵字:</label>
<input type="text" value="" name="s" id="s">
<input type="submit" id="searchsubmit" value="搜尋">
</div>
</form>
Text Content
BLOG 跳至主要內容 * 首頁 * 範例頁面 HTTP -> HTTPS, NIGNX, LET’S ENCRYPT 發佈日期: 2024 年 3 月 5 日,作者: fluber Install Certbot on Ubuntu Host * certificate:/etc/letsencrypt/live/your_domain.com/fullchain.pem * privatekey:/etc/letsencrypt/live/your_domain.com/privkey.pem 分類: 未分類 | 發佈留言 DJANGO OPTIMISTIC LOCKING (樂觀鎖定) 發佈日期: 2024 年 3 月 4 日,作者: fluber current in process record the version will be update += 1, so when in the same time another one do same thing will updated_rows == 0. 分類: Django | 發佈留言 DJANGO PESSIMISTIC LOCKING (悲觀鎖定) 發佈日期: 2024 年 3 月 4 日,作者: fluber when select task by id, the database lock the record. if other one to do same time the second one will get the “Task is already claimed or completed” We use transaction.atomic() as a context manager to ensure that all database operations within the block are atomic, meaning they are either all committed or all rolled back in case of an error. 分類: Django | 發佈留言 DIGANGO VIEWS 發佈日期: 2024 年 3 月 4 日,作者: fluber * Understanding Django Views * avoid add business logic into the view, if embedding business logic directly into the view will make it nonreusable, not testability and coupling. * Django’s Generic Views * from django.views.generic import ListView, DetailView, TemplateView * from django.views.generic.dates import ArchiveIndexView, YearArchiveView, MonthArchiveView, DayArchiveView, TodayArchiveView, DateDetailView * from django.views.generic.edit import FormView, CreateView, DeleteView, UpdateView, DeleteView * use help(ListView) to check detail property and method and so on 1. * Mixins * refers to a class that provides additional functionality to other classes through inheritance. * Django Mixin * ContextMixin: Adds extra context data to the view * TemplateResponseMixin: Renders template and returns an HTTP response * FormMixin: Used to handle form submission and validation * CreateModelMixin: Used to save a new object to database * UpdateModelMixin: Used to upate an existing object in database * DeleteModelMixin: Used to delete an object * URL Configuration * ulrpatterns = [ re_path(r’^tasks/(?P<by_date>[0-9]{4}-[0-9]{2}-[0-9]{2})/$’, views.query_by_date, name=”task_list”),] ^: indicating the begin $: indicateing the last [0-9]{4}: 4 characters and each character is 0~9. (?P<by_date>…….), will pass the value as by_date parameter to the view. r preceding the string is a flag, informing Python that this is a raw string * url path built-in convert: * str * int * slug * uuid * path * url path custom convert * URL Namespace and Name tasks:task-detail to use namespace for urls, use app_name in the urls.py * HttpRequest object * request.method * request.user * request.path * request.GET * request.POST * request.FIELS * request.headers * HttpResponse object * the object accept a parameter that contains the content destined for client. 分類: Django | 發佈留言 USE DOCKER-COMPOSE TO HELP DJANGO DEVELOPMENT 發佈日期: 2024 年 2 月 29 日,作者: fluber cd ~ mkdir practice_folder #create a virtualenv python -m venv .venv .venv\scripts\activate.bat pip install django~=4.0.0 psycopg2-binary~=2.9.9 django-admin startproject django_project . python manage.py runserver 0.0.0.0:8000 pip freeze > requirements.txt create a Dockfile create docker-compose.yml docker-compose up -d –build vim django_project/settings.py In the Windows Host Computer Modify django source code and * docker-compose.exe web python manage.py startapp accounts * docker-compose.exe web python manage.py makemigrations accounts * docker-compose.exe web python manage.py migrate * docker-compose.exe web python manage.py createsuperuser * ………… * 分類: Django | 發佈留言 USE DOCKER TO HELP DJANGO DEVELOPMENT 發佈日期: 2024 年 2 月 26 日,作者: fluber if you have pyenv Dockerfile, you can use docker built -t django:latest . to build a docker image. command: docker run –rm -p 8000:8000 -p 3000:3000 -v c:\Users\Fluber\Project\Docker\django\book_django_beginners\:/home/fluber/code -it django:latest enter a docker console environment to develop. virtualenv .venv to build a python project environment. pip install django==4.0.10 ajango-admin startproject new_project python manage.py startapp new_app modify new_project/settings.py and new_project/urls.py modify new_app/models.py new_app/views.py new_app/urls.py use python manage.py makemigrations use python manage.py migrate using python manage runserver 0.0.0.0:8000 I suggest to study the following books to help you know how to use django. 分類: Docker | 發佈留言 DOCKERFILE FOR PYENV ENVIRONMENT 發佈日期: 2024 年 2 月 26 日,作者: fluber * Use a base image with a specific version of Ubuntu FROM ubuntu:20.04 ENV TZ = Asia\Taipei * Set environment variables for non-interactive apt installation ENV DEBIAN_FRONTEND=noninteractive * Install essential packages RUN apt-get update && \ apt-get install -y \ build-essential \ libssl-dev \ zlib1g-dev \ libbz2-dev \ libreadline-dev \ libsqlite3-dev \ wget \ curl \ llvm \ libncurses5-dev \ libncursesw5-dev \ xz-utils \ tk-dev \ libffi-dev \ liblzma-dev \ python3-venv \ sudo \ git \ tree \ vim \ && rm -rf /var/lib/apt/lists/* * Switch to the /home directory RUN useradd -m -s /bin/bash fluber && \ usermod -aG sudo fluber * Set a password for the ‘fluber’ user (change ‘password’ to your desired password) RUN echo ‘fluber:123456’ | chpasswd * Switch to the ‘fluber’ user USER fluber * Set the working directory to the home directory of the ‘fluber’ user WORKDIR /home/fluber * Install pyenv RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv * Add pyenv to the PATH ENV PATH=”/home/fluber/.pyenv/bin:${PATH}” RUN echo ‘export PYENV_ROOT=”/home/fluber/.pyenv”‘ >> ~/.bashrc RUN echo ‘export PATH=”$PYENV_ROOT/bin:$PATH”‘ >> ~/.bashrc RUN echo ‘eval “$(pyenv init –path)”‘ >> ~/.bashrc RUN echo ‘eval “$(pyenv init -)”‘ >> ~/.bashrc * Install Python 3.8.12 and set it as the default version RUN pyenv install 3.8.12 && \ pyenv global 3.8.12 * Create a user named ‘fluber’ with sudo permissions * Expose any ports you need for your application (if applicable) * EXPOSE … * Start a bash shell when the container runs CMD [“/bin/bash”] 分類: Django | 發佈留言 使用NPX REACT-NATIVE INIT PROJECT的方式時,當加入@REACT-NAVIGATION/BOTTOM-TABS時其圖示無法顯示的問題? 發佈日期: 2023 年 12 月 15 日,作者: fluber 安裝Package npm install --save react-native-vector-icons @types/react-native-vector-icons 在 android > app > build.gradle 檔案加入下列一行∶ apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle") 使用xode打開 ios > project.xcworkspace,如下圖所示新建資料夾Fonts。再將node_modules > react-native-vector-icons > Fonts >Ionicons.ttf 檔案拖拉到xcode專案中的Fonts資料夾下。 在下圖XCode專案中的Info中,新建Fonts provided by application類別,並在此類別下新增一個Item 0值為Ionicons.ttf 下方Tab的圖示就可以正常顯示。 分類: React-Native | 發佈留言 JAVA版本工具SDKMAN 發佈日期: 2023 年 12 月 12 日,作者: fluber 執行指令∶ curl -s “https://get.sdkman.io” | bash 下列Statement將會加入~/.zshrc中 查詢可安裝的Java版本 安裝Java sdk install java Identifier (上表最後一欄的值) 切換Java版本 sdk use java Identifier 分類: React-Native | 發佈留言 安裝NVM環境 發佈日期: 2023 年 12 月 11 日,作者: fluber 作業環境∶ OSX,Homebew 安裝指令∶brew install nvm 執行指令:nvm -h, 瞭解nvm 命令功能 執行指令:nvm ls-remote –lts, 查詢官網長期維護版本 執行指令∶ nvm install v16.20.2 執行指令:nvm ls, 查詢目前電腦系統上所安裝的版本清單及正在使用的是那個版本 執行指令:nvm use, 指定所要使用的版本 分類: React-Native | 發佈留言 * 搜尋關鍵字: * 彙整 * 2024 年 3 月 * 2024 年 2 月 * 2023 年 12 月 * 其他操作 * 登入 blog 本站採用 WordPress 建置