Features
- Admin bug fixed
--------------
cooggerimages
A django app to upload image service
Install
`pip install cooggerimages`
Usege
**/settings.py**
python
INSTALLED_APPS += ["cooggerimages"]
default cooggerimages settings
COOGGERIMAGES = dict(
folder_name="images/"
upload_url="coogger-images/"
upload_url_name="coogger-images"
max_size=4 MB
)
If you want to use a new db for images
**/settings.py**
python
DATABASES["coogger_images"] = dict(
ENGINE="django.db.backends.sqlite3",
NAME="coogger_images",
)
**Example router**
DATABASE_ROUTERS = [
"pat.to.routers.DBRouter",
]
class DBRouter:
default_apps = [
"admin", "auth",
"contenttypes", "sessions",
"steemconnect_auth", "cooggerapp",
]
coogger_images = [
"cooggerimages"
]
def db_for_read(self, model, **hints):
app_label = model._meta.app_label
if app_label in self.default_apps:
return "default"
elif app_label in self.coogger_images:
return "coogger_images"
def db_for_write(self, model, **hints):
return self.db_for_read(model, **hints)
def allow_relation(self, obj1, obj2, **hints):
return True
def allow_migrate(self, db, app_label, model_name=None, **hints):
if db == "default":
if app_label in self.default_apps:
return True
elif db == "coogger_images":
if app_label in self.coogger_images:
return True
return False
**/urls.py**
python
urlpatterns.append(
path("", include("cooggerimages.urls")
)
Then check **http://127.0.0.1:8000/coogger-images/** in your project
![coogger-images](https://raw.githubusercontent.com/coogger/cooggerimages/master/media/coogger-images.PNG)