Total Pageviews

Showing posts with label Django. Show all posts
Showing posts with label Django. Show all posts

Sunday, 12 July 2026

基于Django(后端程序)和 React(前端程序)的协作文本编辑程序docs

 

Docs is an open-source text editor: web-native, made for real-time collaboration, cleanly structured documents and sub-documents with full ownership of your data. Built to scale with Django(后端程序) and React(前端程序)

 

La Suite Docs: Collaborative Text Editing

Docs, where your notes can become knowledge through live collaboration.

Docs is an open-source collaborative editor that helps teams write, organize, and share knowledge together - in real time.

What is Docs?

Docs is an open-source alternative to tools like Notion or Google Docs, focused on:

  • Real-time collaboration
  • Clean, structured documents
  • Knowledge organization
  • Data ownership & self-hosting

Built for public organizations, companies, and open communities.

Why use Docs?

Writing

  • Rich-text & Markdown editing
  • Slash commands & block system
  • Beautiful formatting
  • Offline editing
  • Optional AI writing helpers (rewrite, summarize, translate, fix typos)

Collaboration

  • Live cursors & presence
  • Comments & sharing
  • Granular access control

Knowledge management

  • Subpages & hierarchy
  • Searchable content

Export/Import & interoperability

  • Import to .docx and .md
  • Export to .docx, .odt, .pdf

Try Docs

Experience Docs instantly - no installation required.

Self-hosting

Docs supports Kubernetes, Docker Compose, and community-provided methods such as Nix and YunoHost.

Get started with self-hosting: Installation guide

Warning

Some advanced features (for example: Export as PDF) rely on XL packages from Blocknote. These packages are licensed under GPL and are not MIT-compatible

You can run Docs without these packages by building with:

PUBLISH_AS_MIT=true

This builds an image of Docs without non-MIT features.

More details can be found in environment variables

Local Development (for contributors)

Run Docs locally for development and testing.

Warning

This setup is intended for development and testing only. It uses Minio as an S3-compatible storage backend, but any S3-compatible service can be used.

Prerequisites

  • Docker
  • Docker Compose
  • GNU Make

Verify installation:

docker -v
docker compose version

If you encounter permission errors, you may need to use sudo, or add your user to the docker group.

Bootstrap the project

The easiest way to start is using GNU Make:

make bootstrap FLUSH_ARGS='--no-input'

This builds the app-dev and frontend-dev containers, installs dependencies, runs database migrations, and compiles translations.

It is recommended to run this command after pulling new code.

Start services:

make run

Open https://localhost:3000

Default credentials (development only):

username: impress
password: impress

Frontend development mode

For frontend work, running outside Docker is often more convenient:

make frontend-development-install
make run-frontend-development

Backend only

Starting all services except the frontend container:

make run-backend

Tests & Linting

make frontend-test
make frontend-lint

Backend tests can be run without docker. This is useful to configure PyCharm or VSCode to do it. Removing docker for testing requires to overwrite some URL and port values that are different in and out of Docker. env.d/development/common contains all variables, some of them having to be overwritten by those in env.d/development/common.test.

Demo content

Create a basic demo site:

make demo

More Make targets

To check all available Make rules:

make help

Django admin

Create a superuser:

make superuser

Admin UI: http://localhost:8071/admin

from  https://github.com/suitenumerique/docs

-----

 Docs(https://github.com/suitenumerique/docs)这个项目我一直都在关注,奈何之前的部署方式只支持k8s,如果只是为了部署一个笔记软件去搭一个k8s的话,那真的是有点拿大炮打蚊子那味了= =最近发现这个项目支持用docker compose部署了,遂记录下部署过程与遇到的一些问题。

不得不说国家队还是牛B!这个笔记软件第一次用就感觉挺顺手的,前端UI简洁大气,自带AI功能,可以帮你美化、改写、总结、修正错别字、翻译等。自托管的实例所有功能都能使用,与官方实例1:1还原,而不是像某些“开源笔记”那样吃相难看。

缺点也还是有的,没有十全十美的东西= =目前虽然支持docker compose部署了,但部署起来还是比较麻烦。另外我在使用中发现一些小bug,例如:上传的文件名不能包含中文,有中文就会导致上传失败。导出的PDF文件显示中文是乱码,且不支持代码块等。如果你不介意这些问题的话,可以尝试一下。

本文根据Docs官方的文档(https://github.com/suitenumerique/docs/blob/main/docs/installation/compose.md)编写,进行了一些修改:

1.将Keycloak更换为VoidAuth,因为Keycloak部署和配置都过于复杂。

2.将MinIO更换为Garage,因为开源的MinIO已经名存实亡了。

3.不使用官方的NGINX反向代理配置,因为我的服务器已经运行Ferron Web Server了。


基于django的聊天网站程序Chatapp

 Real Time Chat App Using Django, Channels, JavaScript and much more. 

 

Chat App

pypi python versions license

Real Time Chat App Using Django, Channels, JavaScript, Docker, Tailwind CSS and much more..

🚀 Features:

  • Real-time messaging: The app allows users to send and receive messages in real-time, providing a seamless chatting experience.
  • Django and Channels: The app is built using the Django web framework and Channels, which extends Django to handle WebSockets and other asynchronous protocols.
  • JavaScript: The app uses JavaScript to provide a dynamic and interactive user interface.
  • Docker: The app can be containerised using Docker, making it easy to deploy and manage.
  • Tailwind CSS: The app uses Tailwind CSS, a utility-first CSS framework, to style the user interface.

Is there anything else you would like to know about this chat app?

📸 Screenshots:


Chat Page

📦 Tech Stack:

  • WebSockets - WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection.
  • Django - Django makes it easier to build better web apps more quickly and with less code.
  • Django Channels - Channels is a project that takes Django and extends its abilities beyond HTTP - to handle WebSockets, chat protocols, IoT protocols, and more.
  • Vite - Next Generation Frontend Tooling.
  • Tailwind 3 - Rapidly build modern websites without ever leaving your HTML.
  • Docker - Docker is a platform designed to help developers build, share, and run modern applications. We handle the tedious setup, so you can focus on the code.
  • Postgres DB - The World's Most Advanced Open Source Relational Database.

📦 Getting Started:

  1. Clone the project and make it your own.
mkdir ~/Dev
cd ~/Dev
git clone https://github.com/Arvind-4/Chatapp.git
cd Chatapp
  1. Create virtual environment and activate it.
python3.9 -m venv .
source bin/activate

Use .\venv\Scripts\activate if on Windows.

  1. Install requirements
$(Chatapp) python -m pip install pip --upgrade
$(Chatapp) python -m pip install -r requirements.txt
  1. Open VS Code
code .
  1. Create .env file:

Add Your Credentials .env from .env.sample:

PYTHON_VERSION=

DJANGO_PG_PASSWORD=iz-MAIesYif5c8d53pEnAg
DJANGO_PG_HOST=db
DJANGO_PG_USER=admin
DJANGO_PG_DATABASE=chatdb
DJANGO_PG_PORT=5432

DJANGO_REDIS_HOST=redis
DJANGO_REDIS_PORT=6379

DJANGO_SUPERUSER_EMAIL=
DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_PASSWORD=-_cYnxeqvWQKhCUe_AJn8Q

DJANGO_SECRET_KEY=P_wXmuyfulz3qZTe3bAmRw5d0-9maJ5PIIVDMjMIm1gw
DJANGO_ADMIN_URL=admin/
DJANGO_DEBUG=1
DJANGO_ALLOWED_HOSTS=*
DJANGO_REDIS_AVAILABLE=0
DJANGO_HTTPS_SECURITY=0
DJANGO_LIVE=0

POSTGRES_PASSWORD=iz-MAIesYif5c8d53pEnAg
POSTGRES_USER=admin
POSTGRES_DB=chatdb

Replace your SECRET_KEY with a new one using the code Below.

python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'

Or

bash commands/secret.sh
  1. Build and Start the Docker File:

Below will start a Docker Instance on your local machine to match the .env from the previous step.

docker compose -f docker-compose.selfhost.yaml build

Start the Docker Build Image:

docker compose -f docker-compose.selfhost.yaml up
  1. Run Django Commands & Migrations and Create Superuser
cd ~/Dev/Chatapp
source bin/activate
$(Chatapp) python manage.py makemigrations
$(Chatapp) python manage.py migrate
$(Chatapp) python manage.py createsuperuser

Run the server:

$(Chatapp) python manage.py runserver
  1. Install & Build the Front end.

Install the Required Dependencies

npm run bootstrap

Build the Front end for Production

npm run production

🚀 Deploy:

Click the Button to Deploy to Render.

Deploy to Render

OR

Self Host using Docker, Docker Compose in a VM :)

from  https://github.com/arvind-4/Chatapp

生成QR Code的建站程序 qr-code

 

Simple QR Code Website With Django


Scan here to open our lightning-fast QR code reading website. Built with Django for performance, Bootstrap for design, and Vercel for reliability.

📦 Tech Stack:

  • Django - Django makes it easier to build better web apps more quickly and with less code.
  • Bootstrap - Build fast, responsive sites with Bootstrap.
  • Vercel - Vercel's Front end Cloud provides the developer experience and infrastructure to build, scale, and secure a faster, more personalised Web.

Demo:

Home Page

Getting Started:

  • Clone repository
mkdir ~/Dev/qr-code -p
cd ~/Dev/qr-code
git clone https://github.com/Arvind-4/qr-code.git .
  • Install Dependencies:
cd ~/Dev/qr-code
python3.8 -m pip install virtualenv
python3.8 -m virtualenv . 
source bin/activate
pip install -r requirements.txt
  • Create .env file: Add Your Credentials .env from sample.env:
DJANGO_SECRET_KEY=
DJANGO_DEBUG=

Get your Secret key from:

python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
  • Run Server:
cd ~/Dev/qr-code
python manage.py runserver

Open localhost:8000 in your favourite browser :)

from  https://github.com/arvind-4/qr-code

一个基于python的博客程序 sample-blog


Install Requirements for the project

pip install -r requirements.txt

Run Migrations

python manage.py makemigrations
python manage.py migrate

Run Dev Server:

python manage.py runserver
from  https://github.com/arvind-4/sample-blog
----------
 

Blog Backend

Simple Content Management System build on Django and Django Rest Framework.

Get the Code

  • Clone Repo
git clone https://github.com/Arvind-4/blog-backend
cd blog-backend 
  • Install Virtual Environment and Dependencies
pip install virtualenv
python3.10 -m venv .
source bin/activate
pip install -r requirements.txt
  • Run Local Server
python manage.py runserver
from  https://github.com/arvind-4/blog-backend
-----
A Blog app with comments. 
  
  • Admin Portal:

    • Core data management:

      • Subject List - Dynamically managed (Default list - Physics, Maths, Botany, and Zoology).
      • Category Tags - Dynamically managed (Will be added to the experiments and can be used for filtering purposes).
    • Content Edit feature:

      • Content creation - While creating the content, in the Subject details option the list will be shown dynamically with respect to Core Data Management.
    • Views count option.

    • Blog Page:

      • Add filters option.
      • Provide Claps option to the viewers.
      • Sorting option based on Views and Claps.
    • Frontend Improvements.

Get & Running on your Local Machine

  • Clone the Repo
cd ~/Dev/
mkdir exp
cd exp
git clone  .
  • Create a Virtual Environment for Python

    • using Poetry
     virtualenv --python=python3.9 .
     source bin/activate
     poetry install
    • using Virtualenv
     python -m virtualenv --python=python3.9 .
     source bin/activate
     pip install -r requirements.txt
  • Run Locally

cd ~/Dev/django_vercel
python manage.py runserver
from  https://github.com/arvind-4/exp-website
-------

A simple Blog Using Django Framework

 

Tech Stack:

  • Django - Django makes it easier to build better web apps more quickly and with less code.
  • Bootstrap - Build fast, responsive sites with Bootstrap.
  • Vercel - Vercel's Front end Cloud provides the developer experience and infrastructure to build, scale, and secure a faster, more personalised Web.

Getting Started:

  • Clone repository
mkdir ~/Dev/blog -p
cd ~/Dev/blog
git clone https://github.com/Arvind-4/django-blog.git .
  • Install Dependencies:
cd ~/Dev/blog
python3.8 -m pip install virtualenv
python3.8 -m virtualenv . 
source bin/activate
pip install -r requirements.txt
  • Create .env file: Add Your Credentials .env from sample.env:
DJANGO_SECRET_KEY=
DJANGO_DEBUG=

Get your Secret key from:

python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
  • Run Server:
cd ~/Dev/blog
python manage.py runserver

Open localhost:8000 in your favourite browser :)

from https://github.com/arvind-4/django-blog

-----

 An Open Source Blog Website Powered with Django.

Web Portal

Real Time Web Portal App Using Django, JavaScript, Tailwind CSS and much more..

Tech Stack:

  • Django - Django makes it easier to build better web apps more quickly and with less code.
  • Tailwind 3 - Rapidly build modern websites without ever leaving your HTML.
  • Postgres DB - The World's Most Advanced Open Source Relational Database.

Problem Statement

The proposed web portal aims to provide a platform for the students of Indira Gandhi Delhi Technical University for Women (IGDTUW) to read and access the technical writings, such as blogs, articles, and papers, written by their peers at the university. The main motivation behind this idea is to promote technical writing among students and to make the writings of the students at the university more accessible and widely read among their peers.

The developers are expected to create a user-friendly portal that is easy to navigate, with a clear and intuitive interface. The portal should be designed in such a way that students can easily search and access the writings of their peers with minimal effort. To make it even more user-friendly, the writings should be well-organized and categorized in appropriate sections, such as by topic or field of study, to make it easy for users to discover new content.

Aesthetically, the web portal should be designed with a dark, holographic or neon theme, which will give it a modern and cutting-edge feel. The design should be interactive, intuitive and make it easy for users to find what they are looking for.

It is important to note that the target audience of the portal are students and staff of IGDTUW, so the design should be tailored to the specific needs and preferences of this user group. Additionally, the portal should be scalable and able to handle a large volume of users and writings, as it will be used by a large number of students and staff at the university. The portal also should be provide features such as commenting, rating and discussion features to foster a sense of community among students who write and read the technical writings.

Features

  • User registration and login: This feature will allow students and staff of IGDTUW to create an account on the portal and login to access the technical writing section.
  • Technical writing section: This feature will allow students and staff to browse, read and access technical writings, such as blogs, articles, and papers, written by their peers.
  • Search and filter function: This feature will allow students and staff to easily search and filter through the writings to find the information they need, by topic or field of study,
  • Writing submission feature: This feature will allow students and staff to submit their own technical writings on the portal for others to read.
  • Commenting, rating and discussion: This feature will allow readers and writers to leave comments, rate and discuss the technical writings posted on the portal.

Screenshots:

  • Home Page

  • Sign In

Test Cases Passed:

 from https://github.com/arvind-4/web-portal

Monday, 29 June 2026

一个django博客项目BlogViking666

 https://github.com/wsqy/BlogViking666

( https://github.com/brightmann/BlogViking)

Sunday, 7 December 2025

Django-React

 A repository that shows a Django backend with a React frontend.

This repository shows how to set up a Django backend with a React frontend. It includes a simple Todo application with a REST API.

Getting Started

To get started with this project, follow these steps:

  • Clone the repository:

    git clone https://github.com/emanuelefavero/django-react.git
    cd django-react

Set up a virtual environment:

make virtualenv
 Tip: @see Makefile for all available commands。

Install the required packages:

make install

Add Django .env variables in the root .env file:

SECRET_KEY= # Run `utils/generate_secret_key.py` to generate a new key
DEBUG= # Set to False in production, True for development

Add React .env variables in the frontend/.env file:

NEXT_PUBLIC_SERVER_URL=http://localhost:8000 # Set to your Django server URL
NEXT_PUBLIC_CLIENT_URL=http://localhost:3000 # Set to your React client URL

Run the Django and React development servers:

make run

Now you should have both the Django backend and the React frontend running. You can access the API at http://localhost:8000/api/todo/ and the React app at http://localhost:3000/.

Tip: You can also run the backend and frontend separately using make runserver and make runclient (after opening a new terminal window for the client).

API Endpoints

  • GET /api/todo/ - Retrieve a list of todos

Note: More API endpoints will be added in future updates

Migrations

Make sure to run python manage.py makemigrations and python manage.py migrate to apply database migrations after making changes to the models.

Resources

from  https://github.com/emanuelefavero/django-react

Sunday, 2 February 2025

Wagtail_Blog

 A wordpress like blog app implemented in wagtail. Please open issues and merge requests only in gitlab.

gitlab.com/thelabnyc/wagtail_blog/

pipeline status

A WordPress-like blog app implemented in Wagtail.

What is it

After reimplementing WordPress-like blogs over and over again in Wagtail I decided to just make this. Feel free to use as is or copy it as a starting point. It's based on the Wagtail demo blog but is closer to a standard WordPress blog style.

This is a starting point for your wagtail based blog, especially if you are migrating from Wordpress. It's not Wordpress and it's not drop in. You are expected to add your own templates and are given on a skeleton template to start from.

Features

  • Categories and tags with views
  • RSS
  • Basic starter templates with pagination
  • Comments
  • WordPress importer

Installation

You should start with a existing wagtail django project and have a basic understanding of Wagtail before starting. See http://docs.wagtail.io

Tested with Wagtail 2.x and Django 2.2.

  1. pip install wagtail-blog
  2. Add blog to INSTALLED_APPS
  3. Add url(r'^blog/', include('blog.urls', namespace="blog")), to urls.py
  4. python manage.py migrate
  5. Override templates as needed.

Extending

Wagtail blog features abstract base models. If you want to change functionality you may extend this models from blog.abstract and use them how you'd like. Do not add blog to your INSTALLED_APPS if you do this. You'll need to create your own logic to gather context variables. See blog/models.py for an example of this. Wagtail blog doesn't support any way to "drop in" the blog app and just make minor changes to models.

Settings

  • BLOG_PAGINATION_PER_PAGE (Default 10) Set to change the number of blogs per page. Set to None to disable (useful if using your own pagination implementation).
  • BLOG_LIMIT_AUTHOR_CHOICES_GROUP Optionally set this to limit the author field choices based on this Django Group. Otherwise it defaults to check if user is_staff. Set to a tuple to allow multiple groups.
  • BLOG_LIMIT_AUTHOR_CHOICES_ADMIN Set to true if limiting authors to multiple groups and want to add is_staff users as well.

Import from WordPress

The v2 API is the recommended way to import. It has a cleaner, more recent implementation that is easy to extend as needed. The v1 API and xml import use an older, less maintained, codebase and are kept here just in case they are useful to anyone.

Wordpress API v2

This method works with any reasonably modern Wordpress instance and requires no changes to Wordpress and no authentication is needed. It's tested in both wordpress.com and privately hosted Wordpress instances.

Usage

Use the Django management command import_wordpress and provide the slug of the Blog Index Page you wish to add the pages to. For example if you made a Blog Index Page called "blog" and wanted to import my personal wordpress.com hosted blog run:

./manage.py import_wordpress blog --url=https://public-api.wordpress.com/wp/v2/sites/davidmburke.com

Notice the special wordpress.com url schema. For a private wordpress instance it would typically look like https://example.com/wp-json/wp/v2 instead.

Optional Arguments

  • --convert-images (False) set to True to attempt converting images to Wagtail Image objects. Requires beautifulsoup4.
  • --create-users (False) set to True to create new users out of authors.

Extending

See wordpress_import.py. This project can't predict how you host images or implement comments. It's intended to be modified to suit your project's needs.

JSON API Import

Legacy feature

The import feature requires django-contrib-comments and django-comments-xtd

  1. Enable WordPress JSON API
  2. Create a Blog index page and note the title. Let's pretend my blog index page title is "blog"
  3. Run ./manage.py wordpress_to_wagtail blog --url=http://myblog.com username password the username is your WordPress username with full access to the API. Without this you can't access all blog posts.

This works by getting the json data for your posts and making Wagtail pages for them. It then downloads any images it finds and replaces urls to use your site instead of an external site. Blog authors will become Django users. This is a complex process and is prone to error. You should plan to review the import code and fix some issues. Merge requests welcome to improve this feature.

XML file import

Legacy feature

  1. Create a WordPress XML dump by selecting "export" from the "Tools" section of the WordPress admin page.
  2. Create a Blog index page and note the title. Let's pretend my blog index page title is "blog"
  3. Run ./manage.py wordpress_to_wagtail blog --xml=export.xml where export.xml is the XML export file from your source WordPress site.

The xml importer uses the lxml library.

This feature was tested on wordpress XML exports from exactly a few sites. Like the import procedure above, this process is complex and prone to error.

Comments

django-comments-xtd comments work out of the box. Just install it as directed here. Customizing the xtd comment templates should be all you need - but feel free to review this app's templates which you may want to override.

Feel free to contribute other comment implementations.

from https://github.com/thelabnyc/wagtail_blog

Friday, 31 January 2025

一个基于django的博客程序My_Blog_Site

Welcome to My Blog Site on GitHub! This repository hosts the source code for my personal blog website.

from https://github.com/aashiqahmed97/My_Blog_Site

Monday, 27 January 2025

simple-blog

 Simple blog app with Django REST framework.

from https://github.com/Pyszo/simple-blog

Saturday, 28 December 2024

A Django CMS程序Echoes


Build Status 

Echoes CMS

##Goals

  • CMS with Mustache
  • API for Frontend & Mobile
  • Responsive UI

#Setup

1.Install

pip install -r requirements.txt

2.Setup Database

python manage.py syncdb
python manage.py migrate

3.Run

python manage.py runserver 
from https://github.com/phodal/echoes 

Sunday, 1 December 2024

Django Blog laike9m.com的源码


    这篇文章将简单地描述一下博客的搭建过程。博客源代码见这里
    首先要感谢stevelosh, 博客的基本设计参考了他的博客,来源于stevelosh.com 这篇文章。
    博客从2013.8开始搭建,暑假主要处于学习阶段,学期途中插空写了一点,2014寒假把基本框架完成了。
    对于想基于代码学习/搭建博客的行为,本人不能够更欢迎,但是请至少做到:
    在运行之前修改settings.py,再不济,请至少把这里的email替换成你自己的email

    ADMINS = (
        # ('Your Name', 'your_email@example.com'),
        ('laike9m', 'laike9m@gmail.com'),
    )

    否则,你的代码运行时的出错信息将被发送到我的邮箱,不利于你进行调试,也给我带来极大困扰。不胜感激!!

    之前忘记提到,由于我一开始就使用 Py3,所以代码在很多地方都是 Py2 不兼容的,比如某位 fork 了代码的同学发现不能成功创建文章。排查了一下错误,发现是因为My_Blog/css3two_blog/models.py中有这么一段代码:

    if type(self.body) == bytes:  # sometimes body is str sometimes bytes...
         data = self.body
    elif type(self.body) == str:
         data = self.body.encode('utf-8')

    在 Py3里面,这么写就 cover 了self.body的所有可能情况, data 肯定会被赋值。但是那位同学发现data最后是未定义的,为什么呢?因为他用的是 Py2,所以bodyunicode,自然不行。
    所以建议是,直接采用 Py3 来运行我的 blog,或者 fork 一份然后做一些 Py2 compatible 的修改(我也不知道哪些地方要改)。

    设计

    在博客搭建之初,我就决定要尽可能少写前端代码。最简单的方法自然是使用CMS。实际上有不少使用Django的CMS,比如最著名的django CMS。不过调研一番之后发现一个问题:没有一个支持Python 3。考虑到博客里必然有一堆Unicode字符,我还是希望能用Python 3的,所以就放弃了CMS。
    (2014.6.25 EDIT: 目前发现django CMS已经能支持Python3.4了,至少3.0.2版本以及更新的都可以。参见3.0.2 release
    好在马上找到了替代品:HTML模版。最后使用了css3templates 里面的一个模板。模板基本只包含HTML/CSS/JS代码,这正是我需要的东西,因为后端本来就是想从零开始写的。

    文件路径结构

    用Django建网站,staticmedia 到底怎么放置?这个问题没有标准答案,反正我没有用 STATICFILES_DIRS,也就是把所有static files都放在了appname/static/appname 里面。这样的好处是文件结构比较清晰,坏处是如果app多了同样的文件可能要存很多份,会减慢网站加载速度。下面是我的文件夹结构,供参考,文件均未列出:

    my_blog
    ├─media
    │  ├─content
    │  │  └─BlogPost
    │  │      ├─2009
    │  │      ├─2013
    │  │      ├─2014
    │  │      └─images
    │  └─files
    ├─My_Blog
    │  ├─css3two_blog
    │  │  ├─migrations
    │  │  ├─static
    │  │  │  └─css3two_blog
    │  │  │      ├─documentation
    │  │  │      ├─fonts
    │  │  │      ├─images
    │  │  │      └─js
    │  │  └─templates
    │  │    └─css3two_blog
    │  ├─mytemplatetags
    │  │  └─templatetags
    │  ├─my_blog
    │  └─templates
    │      └─admin
    └─static
        ├─admin
        │  ├─css
        │  ├─img
        │  │  └─gis
        │  └─js
        │     └─admin
        └─css3two_blog
            ├─documentation
            ├─fonts
            ├─images
            └─js
    

    画这个东西的时候才知道Windows/Linux下有个命令叫 [tree][tree],大好评!
    注意在开发的时候,my_blog/static 里面可以不放东西,只要 DEBUG=True 就行。如果要接受文件上传,那么在 urlpatterns 后面添加:

    + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

    实际部署时该怎么来就怎么来。
    有一个 app 叫做 mytemplatetags,它是专门用来装 custom template tags/filters 的,参见 [官方文档:Custom template tags and filters][customtag]. [tree]:http://stackoverflow.com/questions/347551/what-tool-to-use-to-draw-file-tree-diagram [customtag]:https://docs.djangoproject.com/en/1.6/howto/custom-template-tags/

    主机

    在哪里买主机是个需要好好思考的问题。使用VPS的话,可选择的范围很大。但是第一次建网站,没什么经验,怕配置不好。更重要的是用VPS不够短平快,而我希望博客能尽快投入使用。然后就查到了WebFaction。虽然我并不想做广告,但真的向大家推荐这个主机服务,尤其是怕麻烦的人。Webfaction是个PaaS服务,支持许多语言/框架,而且服务很完善,不论是在它的 Q&A Community 提问还是open a ticket,工作人员的解答都很迅速。虽然是美国的主机(也可以选东南亚的),但是国内访问速度不错。至于其它选择,外国人用 heroku 的比较多。国内主机不太了解,SAE 据说不错。 (UPDATE: 现在我已经用了两年多 DigitalOcean,感觉还是非常不错的,参见《决定转投 DigitalOcean》)

    版本控制

    显然是Git+Github,没什么好说的。印象深刻的是有一次在主机上玩火敲了这个命令 find . -not -name 'xxx' | xargs rm,结果大家都懂。还好WebFaction重建一个Django app就是点击几下的事情,代码又在Github上,所以很容易就恢复了。
    还有,settings.py 这个文件最好ignore掉,因为部署和开发在设置上差异很大,所以这个文件在本地和服务器上需要保存不同的版本。顺便分享一下 .gitignore 吧:

    .pydevproject
    .project
    .settings/*
    db.sqlite3
    css3two_blog/migrations/*
    css3two_blog/static/css3two_blog/css/unused/*
    *.pyc
    

    为什么settings.py没有包含在内呢?这个问题比较复杂,在我的另一篇文章 [Django Best Practice: How to deal with settings.py in Git][settings] 里面有详细讲述。 [settings]:http://www.laike9m.com/blog/django-best-practice-how-to-deal-with-settingspy-in-git,27/

    使用Markdown

    这是跟stevelosh学的,而且似乎越来越多的个人博客都在这么做。我的每一篇文章都是用markdown写的,然后渲染成html。关于如何渲染有不同的做法,一开始尝试了pygments + django markup,虽然可以实现代码高亮不过样式比较难看。目前采用的方法是把markdown文本发送给Github API,得到 gfm 格式的html。需要注意的是得到的 html 是没有样式的,所以又在网上找了别人写的 gfm 的 css,添加到页面里,显示出来的页面就和 Github 的 README 差不多了。
    这部分的工作有一定难度,需要设计出一套 markdown 和 html 文件的保存机制,并且能正常应对 admin 界面中的修改/删除操作。具体可见 models.pyadmin.py

    其它

  1. 使用 south 来应对 Model 的变更
  2. 尽量把逻辑放在 modelsviews 来完成,因为Django的 templates 实在很难用
  3. 虽然用了 HTML 模版,但是在前端仍然花了很多时间

from  https://github.com/laike9m/My_Blog

Saturday, 23 November 2024

devdocs.io

 许多编程语言的文档 汇总网站https://devdocs.io

您可以搜索他们的文档,在一个地方查找代码、语法、函数以及代码片段。

Sunday, 17 November 2024

MdBlog-by-PeterChenFisher

 博客网站;基于Django+MySQL

from https://github.com/PeterChenFisher/MdBlog

Wednesday, 13 November 2024

MDBlogLite

 from https://github.com/zakirovtech/MDBlogLite

Stack: Python, Django, PostgreSQL, Redis, Docker, Nginx, Celery

MDBlogLite allows you to deploy a simple blog where posts can be created using Markdown or HTML.

  • The current release includes the ability to create posts, an "About Me" tab, and the standard Django admin panel for managing the author's account.
  • With each new release, additional features will be added.

The goal of this application was defined as creating a simple blog for a single user, so it can be easily deployed on a low-resource VPS.

  • In my case, a VPN was set up on the VPS, which also consumed its resources.
  • You can think of this as a business card website with the capability to write posts.
  • A blog with a more complex architecture will be available soon.

Build Instructions

Ensure Docker and the make utility are installed on the VPS.

  1. Run make environment -> This will create the .env file.
  2. Run make prepare -> This will grant execution permissions to all necessary scripts.
  3. Run make webserver -> This will set up the initial nginx.conf for configuring HTTPS certificates.
  4. Run make build -> This will build the main application container.
  5. Run make up -> This will start all containers.
  6. Run make secure -> This will rewrite the nginx.conf for access via the HTTPS protocol.
  7. Run make restart -> This will restart the web server after configuration changes.

Environment Variables

All essential blog settings should be stored in the .env file located in the env directory.

  • You can see an example structure in the .env.template.
BLOG_NAME=                       # The name of the blog
SITE_DOMAIN=                     # The domain name of the site
ADMIN_ENTRYPOINT=                # The entry point for the admin panel (example: www.domain.com/admin)
ADMIN_USERNAME=                  # The username for the admin account
ADMIN_EMAIL=                     # The email address for the admin account
ADMIN_PASSWORD=                  # The password for the admin account

DJANGO_ENV=production            # The environment setting for Django (production or development)
SECRET_KEY=                      # The secret key for Django
ALLOWED_HOSTS=                   # A comma-separated list of allowed hosts (example: example.org,localhost,12.23.345)

SESSION_COOKIE_SECURE=True       # Set to True for secure cookies over HTTPS
SESSION_COOKIE_AGE=              # The age of session cookies in seconds (When cookies expires, you will need re-login)
SESSION_COOKIE_HTTPONLY=True     # Set to True to prevent JavaScript access to cookies

RATE_LIMIT_VALUE=15              # Maximum number of requests allowed
RATE_LIMIT_WINDOW=3              # Time window (in minutes) for rate limiting
BAN_TIMEOUT=120                  # Time (in seconds) for banning an IP

POSTGRES_USER=                   # PostgreSQL database username
POSTGRES_PASSWORD=               # PostgreSQL database password
POSTGRES_DB=                     # Name of the PostgreSQL database
DB_HOST=                         # Hostname or IP address of the database server
DB_PORT=5432                     # Port number for the database connection

CACHE_DOMAIN=                    # Domain for the cache service
REDIS_PASSWORD=                  # Password for the Redis server
REDIS_PORT=6379                  # Port number for the Redis server
CACHE_TIMEOUT=                   # Cache timeout in seconds

SENTRY_STATUS=OFF                # Enable or disable Sentry error tracking (ON/OFF)
SENTRY_DSN=                      # Sentry DSN for error tracking

RECAPTCHA_SITEKEY=               # Your reCaptcha public sitekey
RECAPTCHA_SECRET=                # Your reCaptcha secret key

Thursday, 17 October 2024

awesome-saas-boilerplates

 

Flutter (Dart)

Jetpack Compose (Kotlin)

iOS (Swift / SwiftUI)

Ruby on Rails

Vue

Node.js (Javascript)

Laravel (PHP)

NestJs (Typescript)

Symfony (PHP)

SvelteKit (Javascript)

WordPress (PHP)

Django (Python)

Flask (Python)

FastAPI (Python)

.NET (ASP.NET Core / .NET 6+)

Java

Go

Next.js

React Native

Plasmo (React)

Rare

Remix

Ionic Framework

AWS

Firebase

from https://github.com/smirnov-am/awesome-saas-boilerplates