Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

easyfirebase

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easyfirebase

A Firebase-django integration package where your files are uploaded to Firebase and the rest of the work is done by the package.

  • 2.0.0
  • PyPI
  • Socket score

Maintainers
1

EasyFirebase

An easy implementation of Firebase in django application. If you do not want to upload your static files (ex: Image, pdf etc.) to the server then you can use easyfirebase to upload all of your static files to Firebase and easyfirebase will do the rest. Updating your file on updating models, deletions of file while you delete your model object or changes the file etc.

Usage

  from easyfirebase.fields import FirebaseImageField
  from easyfirebase.storage import FirebaseStorage

  class MyModel(models.Model):
    name = models.CharField(max_length=100)
    #...
    photo = models.FirebaseImageField(storage=FirebaseStorage, ... )

If you do not provide any parameter for storage, then easyfirebase will use Default Django storage, which will store your image/pdf files in the local/server root dir or upload dir provided by STATIC_ROOT.

Installation

  pip install easyfirebase

Or,

Download the tar file and run the following command in django environment.

  pip install ./easyfirebase.tar.gz

add the app name in the settings.py of project.

  INSTALLED_APPS = [
    ...
    'easyfirebase',
    ...
    ]

Configure Settings.py

Get your firebase json config file and info from firebase console. Write the following code in your projects settings.py file:


  FIREBASE_CONFIG = {
      "apiKey": "your api key",
      "authDomain": "your domain name",
      "databaseURL": "your databaseURL",
      "projectId": "your projectID",
      "storageBucket": "your storageBucket",
      "messagingSenderId": "your messagingSenderId",
      "appId": "your app id",
      "measurementId": "your measurementId",
  }

  FIREBASE_CREDENTIALS_FILE = (
      BASE_DIR / "path/to/your/firebase/config/file.json"
  )

[optional: settings.py]

FIREBASE_DEFAULT_UPLOAD_DIR = "test_dir"

This will set the default upload directory for all FirebaseImageField instances in the Firebase Storage. If not provided, easyfirebase will first try to set the Project_name as the default upload dir in the Firebase Storage. or if the above also fails, FreeDjangoFirebase/ will be the default upload dir.

Note: You must put your FIREBASE_CONFIG in settings.py and put your firebase sdk json file in the BASE_DIR of the project. ie, in the directory where settings.py resides.

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc