Getting Started¶
jodit-python is a Python/FastAPI implementation of the Jodit File Browser and Uploader connector. The Jodit editor's file browser and uploader work with it without any change on the client side.
Overview¶
- File operations: browse, upload (from the browser or from a URL), download, rename, move, copy, delete
- Folder management: create, rename, move, copy, delete, tree view
- Image processing: resize, crop, save from the image editor, thumbnails
- Document generation: PDF and DOCX from HTML
- Authentication and ACL: role per request, rules by role, path and extension, static or loaded at runtime
- FastAPI integration: standalone app or a router mounted into your application, several isolated instances side by side
- Storage: local filesystem or AWS S3 / S3-compatible out of the box, custom adapters for anything else
- Multi-tenant: sources resolved per request
Installation¶
Python 3.14+ is required. [all] adds PDF export (WeasyPrint, which needs the Pango system library), DOCX export and S3 storage; each can also be installed alone ([pdf], [docx], [s3]), see Installation.
Quick Start¶
Standalone server¶
The jcpy command serves the connector on http://0.0.0.0:8081 (HOST and PORT change it):
From Python¶
Settings live in a JSON file; only what differs from the defaults needs to be there:
{
"sources": {
"uploads": {
"title": "Uploads",
"root": "/var/www/uploads",
"baseurl": "https://example.com/uploads/"
}
}
}
Callbacks (authentication, dynamic rules, custom icons...) are passed in code:
from starlette.requests import Request
from jcpy import create_app
async def check_authentication(request: Request) -> str:
token = request.headers.get("authorization")
return "admin" if token == "Bearer secret" else "guest"
app = create_app("config.json", check_authentication=check_authentication)
Serving the files¶
The connector manages files but does not serve them: thumbnails and file links point to baseurl, which must be served by a web server or a CDN. With nginx:
location /uploads/ {
alias /var/www/uploads/;
}
location /jodit/connector/ {
proxy_pass http://127.0.0.1:8081/;
client_max_body_size 16m;
}
Jodit Editor¶
Jodit.make('#editor', {
uploader: {
url: '/jodit/connector/?action=fileUpload'
},
filebrowser: {
ajax: {
url: '/jodit/connector/'
}
}
});
Try it in the browser¶
From a checkout of the repository:
It opens http://localhost:8080/demo/ in the browser (NO_BROWSER=1 skips that): the Jodit PRO file browser (from a CDN) connected to jodit-python on port
8081. Jodit PRO needs no license key on localhost; on other hosts it shows a "Trial version" notice. The page and the files (./files) are served on port 8080; the connector uses demo/config.json. Another connector can be tried with http://localhost:8080/demo/?connector=https://example.com/connector/.
Jodit's uploader does not name the action, so its URL carries it: uploader: { url: 'https://example.com/connector/?action=fileUpload' }.
Next Steps¶
- Installation & Setup: environment variables and configuration sources
- Python API:
create_app,create_router, callbacks - FastAPI Integration: mounting into an existing application, several instances
- API Endpoints: every action with parameters and answers
- Authentication and Access Control
- Configuration: every setting
- Docker