solution
Werkzeug==2.2.2
solution
Werkzeug==2.2.2
ปัญหาตอน start docker
sharingd wants to use the “Local Items” keychain
พอเข้าไปดู keychain เห็นว่าหลายอัน has expired
วิธีแก้คือ reset factory keychain โดยในหน้า keychain
keychain access > preferences > reset my default keychain
ขอบคุณ Dr. Neda และ Apple Support Team (https://www.apple.com/support/systemstatus/)
requirements.txt
djangorestframework
settings.py
INSTALLED_APPS = [
...
'rest_framework',
]
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}
root urls.py
urlpatterns = [
...
path('api-auth/', include('rest_framework.urls'))
]
serializers.py
from rest_framework import serializers
from .models import Author, Book
class AuthorSerializer(serializers.ModelSerializer):
class Meta:
model = Author
fields = '__all__'
class BookSerializer(serializers.ModelSerializer):
class Meta:
model = Book
fields = '__all__'
views.py
from rest_framework import generics
from .models import Author, Book
from .serializers import AuthorSerializer, BookSerializer
class AuthorListCreateView(generics.ListCreateAPIView):
queryset = Author.objects.all()
serializer_class = AuthorSerializer
class BookListCreateView(generics.ListCreateAPIView):
queryset = Book.objects.all()
serializer_class = BookSerializer
insert
curl -X POST -H "Content-Type: application/json" -d '{"name": "John Doe"}' http://your-api-url/authors/
curl -X POST -H "Content-Type: application/json" -d '{"title": "The Great Gatsby", "author": 1}' http://your-api-url/books/
Solution1 : use https
Solution2: not recommended in production
Create a network_security_config.xml file in the res/xml directory:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<!-- You can add your custom trust anchors if needed -->
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
AndroidManifest.xml
<application
...
android:networkSecurityConfig="@xml/network_security_config">
...
</application>
res > values > strings.xml
<resources>
<string name="app_name">Change here</string>
</resources>
Gradle Scripts > settings.gradle
rootProject.name = "Change here (too)"
use “android:translationZ”
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="50dp"
android:layout_height="50dp"
android:translationZ="2dp"
android:layout_centerInParent="true"/>
build.gradle (app)
dependencies {
implementation "androidx.core:core-splashscreen:1.0.0"
}
themes.xml
<item name="android:windowSplashScreenBackground">@color/...</item>
ref: https://developer.android.com/develop/ui/views/launch/splash-screen
res/font ( New > Android resource directory; resource type : font )
res/font/put_font_here.ttf
NOTE: rename font to use lower character and _ only
res/font/whatever ( New > Font resource file )
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
<font
android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/lobster_regular" />
<font
android:fontStyle="italic"
android:fontWeight="400"
android:font="@font/lobster_italic" />
</font-family>
Use in TextView
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/lobster"/>
change font : https://developer.android.com/develop/ui/views/text-and-emoji/fonts-in-xml