Skip to content

uploadcare/pyuploadcare-example

main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
img
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Pyuploadcare Example app

This example project demonstrates the pyuploadcare capabilities. The project is based on Python 3.9 and Django 3.2.8.

Installation

Using Docker

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 build directive:

$ git clone git@github.com: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 http://localhost:8000

Without docker

First of all, clone this repository:

$ git clone git@github.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 http://localhost:8000

Usage

Configuration

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 directive:

$ export UPLOADCARE_PUBLIC_KEY=demopublickey
$ export UPLOADCARE_SECRET_KEY=demoprivatekey

Project section

You can get the project information by your public key.

Project info

Files section

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 show page.

Files index

To go to the show page, simply click on a filename:

Show file page

The 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.

Batch store files

File Groups section

File Groups section provides user interface to manage file groups on Uploadcare.

The index page shows a minimal info about each group including ID and files count.

Index groups

Click on a group ID, you go to the show group page:

Show groups

Files uploading

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.

Upload file

Conversion

The application can manage documents and video conversions sending request to Uploadcare REST API Conversion endpoints.


NOTE

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.


Documents conversion

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 jpg or 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.

Convert document

After the form is submitted, you'll see a Conversion result page, which shows some info about conversion: Status, Error and link to the output file. Updating the page will refresh the status.

Convert document result

Video conversion

Video conversion works the same way but the form has some additional parameters to set.

Convert video

Conversion result page also includes information about how conversion is going.

Convert video result

Webhooks

The webhooks section represents CRUD(create, read, update, delete) operations for Uploadcare webhooks.


NOTE

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.

Webhooks list

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.

Webhook's info

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.

Create a webhook

Posts section

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 title, content, logo and attachments. Logo and attachments represent uploadcare.File and uploadcare.FileGroup respectively.

Index page for posts shows a list of posts. Each list item has edit/delete actions.

Posts list

Clicking on title will direct you to the show page of a post.

Show 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 — true.

Create a post

Useful links

About

Pyuploadcare Example app

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages