Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Mickey is a Django package to create a blog site quickly and easily. Mickey provide severals public REST APIs which can be integrated with frontend which are for such as Category List, Tag List, Post List etc. Mickey also provide a little bit customized Django admin from where user can easily create groups, site information, category, sub category, blog posts and media images.
Install django rest framework
and Pillow
Add "rest_framework" and "mickey" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
...
'rest_framework',
'mickey',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'mickey.middleware.CurrentUserMiddleware'
]
from django.urls import path, re_path, include
from django.conf.urls import url
from django.conf import settings
from django.conf.urls.static import static
from mickey import urls as blog_urls
re_path(r"^api/v1/", include(blog_urls)),
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media/images/")
STATIC_ROOT = os.path.join(BASE_DIR, "static")
Run python manage.py makemigrations
and python manage.py migrate
to create all models.
Start the development server and visit http://127.0.0.1:8000/admin/ to create a poll (you'll need the Admin app enabled).
Create Category, Subcategory, Tags, Media files and blog posts from django admin.
Public REST APIs endpoints are::
'categories': 'http://localhost:8000/api/v1/public/categories/',
'tags': 'http://localhost:8000/api/v1/public/tags/'
'posts': 'http://localhost:8000/api/v1/public/posts/',
'reacts': 'http://localhost:8000/api/v1/public/reacts/',
'comments': 'http://localhost:8000/api/v1/public/comments/',
'site-information': 'http://localhost:8000/api/v1/public/site-information/'
Mickey provide APIs for public post and archive post. /api/v1/public/posts/
and /api/v1/public/posts/?type=published
both API endpoints fetch all posts which are published and not archive. /api/v1/public/posts/?type=archive
To make a post
archive, mark check box archive in django admin. Remember a archive post is also a published post but in a different scheme.
To get all posts for a single tag use the API endpoint /api/v1/public/posts/?tag=
In Mickey, image need to choose in time of creation a blog post. Hence there is a media browser named Media. To use any image, first need to upload images from Media. In each time of uploading a single image, Mickey created extra 2 copy of same image with different size which are mainly medium and small size. By default the medium and small size are (768,1024) and (265, 300).
But you can override the size from settings.py file which is your root app folder. To change, create two variable
in your setting.py file named MID_IMAGE_SIZE
and SM_IMAGE_SIZE
and assign to them image sizes as a tuple.
Example ::
MID_IMAGE_SIZE = (768, 1024)
SM_IMAGE_SIZE = (264, 300)
FAQs
A Django package to build complete blog site.
We found that mickey demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.