Pyuploadcare Example app
This example project demonstrates the pyuploadcare capabilities. The project is based on Python 3.9 and Django 3.2.8.
- Useful links
To install the example application you need to install Docker Compose package.
When Docker Compose is installed, clone this repository and build a Docker image by using the
$ git clone firstname.lastname@example.org:uploadcare/pyuploadcare-example.git $ docker-compose build
This command will build an image for the application.
When the image is ready — up the containers with the following command.
$ docker-compose up -d
Then, apply migrations:
$ docker-compose run --rm uploadcare ./manage.py migrate
Now, the application must be available in your web-browser, on
First of all, clone this repository:
$ git clone email@example.com:uploadcare/pyuploadcare-example.git
Make sure Python and Poetry are installed on your system. Fire command prompt and run command:
$ python -V Python 3.9.6 $ poetry --version Poetry version 1.1.9
If Python or Poetry are not installed, check out following links with instructions, how to install those:
Then install dependencies:
$ poetry install
After dependencies are installed, apply database migrations:
$ poetry run python app/manage.py migrate
Now, you can run the server:
$ poetry run python app/manage.py runserver
and see the application available in your web-browser, on
To start using tha application you need to set your API keys (public key and secret key).
These keys can be set as ENV variables using the
$ export UPLOADCARE_PUBLIC_KEY=demopublickey $ export UPLOADCARE_SECRET_KEY=demoprivatekey
You can get the project information by your public key.
This section contains operations with files. Such as uploading, copying, storing, deleting and creating file groups.
The page shows all the files you have on Uploadcare servers. Each file has actions, so it is possible to manage files on this page as well as on the
To go to the
show page, simply click on a filename:
index page also supports batch operations pages — batch store, batch delete, create file group from selected files.
Just select multiple files and apply batch action.
File Groups section
File Groups section provides user interface to manage file groups on Uploadcare.
index page shows a minimal info about each group including ID and files count.
Click on a group ID, you go to the
show group page:
To upload file, click on
Upload button in files index page. Then click
Choose file on the form to upload local file or input file's URL.
The application can manage documents and video conversions sending request to Uploadcare REST API Conversion endpoints.
Remember, to convert files, your account must have this feature enabled. It means that your UPLOADCARE_PUBLIC_KEY and UPLOADCARE_SECRET_KEY (not demo keys) must be specified in environment variables. This feature is only available for paid plans.
To convert a document, go to the
Convert document section, choose a file to convert, target format and page (if the chosen target format is
png and you want to convert a single page of a multi-paged document). There is a
Store checkbox responsible for storing files as mentioned above.
After the form is submitted, you'll see a
Conversion result page, which shows some info about conversion:
Error and link to the output file.
Updating the page will refresh the status.
Video conversion works the same way but the form has some additional parameters to set.
Conversion result page also includes information about how conversion is going.
webhooks section represents CRUD(create, read, update, delete) operations for Uploadcare webhooks.
Remember, to manage webhooks, your account must have this feature enabled. It means that your UPLOADCARE_PUBLIC_KEY and UPLOADCARE_SECRET_KEY (not demo keys) must be specified in environment variables. This feature is only available for paid plans.
The menu button
Webhooks points to the webhooks list page. Each list item has
edit/delete actions and minimal info about a webhook.
Clicking on an ID of a list item redirects you to the
show page of a webhook. Here you can find additional info and actions.
To create a new webhook, click the
Create a webhook button in the menu. On the form, you should specify an URL for your webhook and check if it should be enabled immediately.
This section of the application made to demonstrate view helpers that allow to place Uploadcare File Uploader widget to a Django template.
The app has a model called Post and having fields
attachments. Logo and attachments represent
Index page for posts shows a list of posts. Each list item has
Clicking on title will direct you to the
show page of a post.
To create a new post, click on the
Add button in posts index page. The post form will be opened. The form contains a text fields for post title and content, one File Uploader — for post's logo and one — for post's attachments. These File Uploaders differ from each other by the
multiple option. For logo it is
false, and for attachments —