[![image](https://img.shields.io/pypi/v/python-bridge.svg)](https://pypi.python.org/pypi/python-bridge)
[![image](https://img.shields.io/pypi/l/python-bridge.svg)](https://pypi.python.org/pypi/python-bridge)
[![image](https://img.shields.io/pypi/pyversions/python-bridge.svg)](https://pypi.python.org/pypi/python-bridge)
[![image](https://github.com/Never-Over/bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/Never-Over/bridge/actions/workflows/ci.yml)
[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
# bridge
Fully automate your infrastructure for Django.
![](https://raw.githubusercontent.com/Never-Over/bridge/main/docs/runserver_demo.gif)
[Full Documentation](https://never-over.github.io/bridge/)
### What is bridge?
Bridge enables you to seamlessly run and deploy all the infrastructure you need for a complete Django project.
- Two lines of copy-paste configuration
- Local Postgres database automatically configured and connected
- Local Redis instance automatically configured and connected
- Local Celery and Celery Flower instance automatically configured and connected
- Easy one-command deploy configuration to Render
### Installation
Install [Docker](https://docs.docker.com/get-docker/) and verify it's running:
```bash
> docker version
Client: ...
```
Install bridge:
```bash
pip install python-bridge
```
### Usage
Add the following code to the end of your `settings.py` file (or `DJANGO_SETTINGS_MODULE`):
```python
from bridge.django import configure
configure(locals())
```
The next time you start up your application, bridge will create and configure local infrastructure for you:
```bash
> ./manage.py runserver
Setting up service bridge_postgres...
[12:00:00] ✓ Image postgres:12 pulled
[12:00:00] ✓ Container bridge_postgres started
[12:00:00] ✓ bridge_postgres is ready
Service bridge_postgres started!
Setting up service bridge_redis...
[12:00:00] ✓ Image redis:7.2.4 pulled
[12:00:00] ✓ Container bridge_redis started
[12:00:00] ✓ bridge_redis is ready
Service bridge_redis started!
Setting up service bridge_celery...
[12:00:00] ✓ Local worker started
Service bridge_celery started!
Setting up service bridge_flower...
[12:00:00] ✓ Flower started
Service bridge_flower started!
Performing system checks...
System check identified no issues (0 silenced).
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
```
That's it! You now have all the local infrastructure you need to run your django application.
### Deploys
Bridge can also handle deployed configuration for your app as well! Simply run:
```bash
bridge init render
```
You may be prompted for the entrypoint of your application and settings file if bridge cannot detect them.
Bridge will create all the configuration necessary for you to immediately deploy to [Render](https://render.com/). This includes a Blueprint `render.yaml` as well as build scripts and start scripts for your Django application.
After running `bridge init render`, commit the changes and visit your project on github. You will see the following button at the end of your README in the root of your repository:
![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)
To deploy your application to the world, simply click the button! Bridge will configure everything needed for Render to deploy and host your app.
In the future, we'll look into supporting more deployment runtimes such as Heroku, AWS, GCP, Azure, and more.
### FAQ
How does bridge work?
- Bridge spins up and runs all the services needed for your infrastructure in the background. Postgres and Redis run in docker containers, while Celery and Celery Flower (which need to understand your application code) run as background processes.
What if I don't need all the services that bridge provides?
- Bridge is designed to be modular. You can configure only the services you need by editing the `bridge.yaml` file that bridge creates in your project root. By default, `enable_postgres: true` and `enable_worker: true` are set, but you can change these to `false` to prevent bridge from configuring Postgres and Celery respectively.
How can I stop the services that bridge spins up?
- `bridge stop` will stop all running services.
How can I access the database directly?
- Locally, bridge provides access to a psql shell through `bridge db shell`. Remotely, [Render has instructions for connecting](https://docs.render.com/databases#connecting-with-the-external-url).
How can I access redis directly?
- Bridge provides access to redis-cli through `bridge redis shell`. Remotely, [Render has instructions for connecting](https://docs.render.com/redis#connecting-using-redis-cli).
How can I access Celery?
- Flower is a web interface into all the information you need to debug and work with Celery. By default, bridge will run Flower on http://localhost:5555.
Raw data
{
"_id": null,
"home_page": null,
"name": "python-bridge",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "python, deployment, local, infrastructure, postgres, django, architecture",
"author": null,
"author_email": "Caelean Barnes <caeleanb@gmail.com>, Evan Doyle <evanmdoyle@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/49/9b/f4fcca4c7f634d6cea5b626ed9013ab35036b2c12e46ec8ccd8178dd436b/python_bridge-0.1.1.tar.gz",
"platform": null,
"description": "[![image](https://img.shields.io/pypi/v/python-bridge.svg)](https://pypi.python.org/pypi/python-bridge)\n[![image](https://img.shields.io/pypi/l/python-bridge.svg)](https://pypi.python.org/pypi/python-bridge)\n[![image](https://img.shields.io/pypi/pyversions/python-bridge.svg)](https://pypi.python.org/pypi/python-bridge)\n[![image](https://github.com/Never-Over/bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/Never-Over/bridge/actions/workflows/ci.yml)\n[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n# bridge\nFully automate your infrastructure for Django.\n\n![](https://raw.githubusercontent.com/Never-Over/bridge/main/docs/runserver_demo.gif)\n\n[Full Documentation](https://never-over.github.io/bridge/)\n\n### What is bridge?\nBridge enables you to seamlessly run and deploy all the infrastructure you need for a complete Django project.\n\n- Two lines of copy-paste configuration\n- Local Postgres database automatically configured and connected\n- Local Redis instance automatically configured and connected\n- Local Celery and Celery Flower instance automatically configured and connected\n- Easy one-command deploy configuration to Render\n\n### Installation\nInstall [Docker](https://docs.docker.com/get-docker/) and verify it's running:\n```bash\n> docker version\nClient: ...\n```\nInstall bridge:\n```bash\npip install python-bridge\n```\n### Usage\nAdd the following code to the end of your `settings.py` file (or `DJANGO_SETTINGS_MODULE`):\n```python\nfrom bridge.django import configure\n\nconfigure(locals())\n```\n\n\nThe next time you start up your application, bridge will create and configure local infrastructure for you:\n```bash\n> ./manage.py runserver\n\nSetting up service bridge_postgres...\n[12:00:00] \u2713 Image postgres:12 pulled\n[12:00:00] \u2713 Container bridge_postgres started\n[12:00:00] \u2713 bridge_postgres is ready\nService bridge_postgres started!\nSetting up service bridge_redis...\n[12:00:00] \u2713 Image redis:7.2.4 pulled\n[12:00:00] \u2713 Container bridge_redis started\n[12:00:00] \u2713 bridge_redis is ready\nService bridge_redis started!\nSetting up service bridge_celery...\n[12:00:00] \u2713 Local worker started\nService bridge_celery started!\nSetting up service bridge_flower...\n[12:00:00] \u2713 Flower started\nService bridge_flower started!\nPerforming system checks...\n\nSystem check identified no issues (0 silenced).\nStarting development server at http://127.0.0.1:8000/\nQuit the server with CONTROL-C.\n```\nThat's it! You now have all the local infrastructure you need to run your django application.\n\n### Deploys\nBridge can also handle deployed configuration for your app as well! Simply run:\n```bash\nbridge init render\n```\nYou may be prompted for the entrypoint of your application and settings file if bridge cannot detect them. \nBridge will create all the configuration necessary for you to immediately deploy to [Render](https://render.com/). This includes a Blueprint `render.yaml` as well as build scripts and start scripts for your Django application.\nAfter running `bridge init render`, commit the changes and visit your project on github. You will see the following button at the end of your README in the root of your repository:\n\n![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)\n\nTo deploy your application to the world, simply click the button! Bridge will configure everything needed for Render to deploy and host your app.\n\nIn the future, we'll look into supporting more deployment runtimes such as Heroku, AWS, GCP, Azure, and more.\n\n### FAQ\n\nHow does bridge work?\n- Bridge spins up and runs all the services needed for your infrastructure in the background. Postgres and Redis run in docker containers, while Celery and Celery Flower (which need to understand your application code) run as background processes.\n\nWhat if I don't need all the services that bridge provides?\n- Bridge is designed to be modular. You can configure only the services you need by editing the `bridge.yaml` file that bridge creates in your project root. By default, `enable_postgres: true` and `enable_worker: true` are set, but you can change these to `false` to prevent bridge from configuring Postgres and Celery respectively.\n\nHow can I stop the services that bridge spins up?\n- `bridge stop` will stop all running services.\n\nHow can I access the database directly?\n- Locally, bridge provides access to a psql shell through `bridge db shell`. Remotely, [Render has instructions for connecting](https://docs.render.com/databases#connecting-with-the-external-url). \n\nHow can I access redis directly?\n- Bridge provides access to redis-cli through `bridge redis shell`. Remotely, [Render has instructions for connecting](https://docs.render.com/redis#connecting-using-redis-cli).\n\nHow can I access Celery?\n- Flower is a web interface into all the information you need to debug and work with Celery. By default, bridge will run Flower on http://localhost:5555.\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python tool to abstract your Django infrastructure.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/never-over/bridge",
"Issues": "https://github.com/never-over/bridge/issues"
},
"split_keywords": [
"python",
" deployment",
" local",
" infrastructure",
" postgres",
" django",
" architecture"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "233800a98e636a013d7b45d34eddea935b3cde28a7a2b0774c9b939524cd28f1",
"md5": "9b373bfb833b2855c44e7f5df8bb2086",
"sha256": "e9bb894998d42388538b2f25af571e6aac4032c6f9da60afa8acb6bcd0e2a169"
},
"downloads": -1,
"filename": "python_bridge-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9b373bfb833b2855c44e7f5df8bb2086",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 41360,
"upload_time": "2024-05-02T23:54:04",
"upload_time_iso_8601": "2024-05-02T23:54:04.773470Z",
"url": "https://files.pythonhosted.org/packages/23/38/00a98e636a013d7b45d34eddea935b3cde28a7a2b0774c9b939524cd28f1/python_bridge-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "499bf4fcca4c7f634d6cea5b626ed9013ab35036b2c12e46ec8ccd8178dd436b",
"md5": "b7227578c22c491acf5bfc4c7a929978",
"sha256": "766ab7496fa2983fa837e11a9fad4d48247c725196aed2c67aa7c342adcd470f"
},
"downloads": -1,
"filename": "python_bridge-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "b7227578c22c491acf5bfc4c7a929978",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 33894,
"upload_time": "2024-05-02T23:54:06",
"upload_time_iso_8601": "2024-05-02T23:54:06.793876Z",
"url": "https://files.pythonhosted.org/packages/49/9b/f4fcca4c7f634d6cea5b626ed9013ab35036b2c12e46ec8ccd8178dd436b/python_bridge-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-02 23:54:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "never-over",
"github_project": "bridge",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "python-bridge"
}