Skip to main content

Django Rapid Development Assistant Tool

Project description

D

快速开始

自动注册模型到Admin

setting.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'DjangoDynamicDrive.dynamic',
    # 你的APP
    'testapp',
]

数据库路由,指定Django app 使用所选择的数据库

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'default',
        'USER': '你的账户',
        'PASSWORD': '你的密码',
        'HOST': '数据库的IP或者host',
        'PORT': '数据库服务开放的端口',
    },
    'logsdb': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'logs',
        'USER': '你的账户',
        'PASSWORD': '你的密码',
        'HOST': '数据库的IP或者host',
        'PORT': '数据库服务开放的端口',
    }
}

# 数据库路由
DATABASE_ROUTERS = ['DjangoDynamicDrive.db.database_router.DatabaseAppsRouter']
# 应用与数据库映射
DATABASE_APPS_MAPPING = {
    'testapp': 'logsdb',
    # app名称:数据库路由
}

数据库迁移

python manage.py makemigrations
python manage.py migrate --database=logsdb

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djangodynamicdrive-0.0.4.tar.gz (5.6 kB view hashes)

Uploaded Source

Built Distribution

djangodynamicdrive-0.0.4-py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page