{ "info": { "author": "ni1mi213", "author_email": "niimi213.py@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# django-conoha-objstorage\ndjango-conoha-objstorage\u306f\u3001Django\u306eFileFiled\u3092Conoha\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u4fdd\u5b58\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\n\n## Quickstart\nsetting.py\u306b\u4e0b\u8a18\u306e\u5185\u5bb9\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\n`INSTALLED_APPS`\u306bdjango_conohoa_objstorage\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\n```python\nINSTALLED_APPS = [\n 'django_conoha_objstorage',\n ...\n ]\n```\n\n\u74b0\u5883\u5909\u6570\u306b\u30c6\u30ca\u30f3\u30c8\u60c5\u5831\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\n```python\nfrom dotenv import load_dotenv\n\ndotenv_path = os.path.join(os.path.dirname(__file__), '.env')\nload_dotenv(dotenv_path)\n\nOS_TENANT_NAME = os.environ['OS_TENANT_NAME']\nOS_TENANT_ID = os.environ['OS_TENANT_ID']\nOS_USERNAME = os.environ['OS_USERNAME']\nOS_PASSWORD = os.environ['OS_PASSWORD']\nOS_AUTH_URL = os.environ['OS_AUTH_URL']\nOS_ENDPOINT_URL = os.environ['OS_ENDPOINT_URL']\nOS_TEMPURL_KEY = os.environ['OS_TEMPURL_KEY']\n```\n\n\u4f7f\u7528\u3059\u308bSTORAGE\u3068\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\n```python\nDEFAULT_FILE_STORAGE = 'django_conoha_objstorage.backend.ConohaObjectStorage'\nDEFAULT_CONTAINER = 'your_container_name'\n```\n\u3053\u308c\u3067django-conoha-objstorage\u3092\u4f7f\u3046\u6e96\u5099\u304c\u3067\u304d\u307e\u3057\u305f\u3002\n\n## Define the model\nFileFiled\u3092\u306e\u30ab\u30e9\u30e0\u3092\u6301\u3064\u30e2\u30c7\u30eb\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002\n```python\nfrom django.db import models\n\nclass Post(models.Model):\n title = models.CharField(max_length=255)\n object = models.FileField(upload_to='your_container_name')\n```\n\u3042\u3068\u306f\u4fdd\u5b58\u3059\u308b\u3060\u3051\u3067`upload_to`\u306b\u6307\u5b9a\u3057\u305fcontainer\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u4fdd\u5b58\u3055\u308c\u307e\u3059\u3002\n\n## Usage of abstract base class\ndjango_conoha_objstorage.models\u306b\u62bd\u8c61\u57fa\u5e95\u30af\u30e9\u30b9\u304c\u3042\u308a\u307e\u3059\u3002\u4f7f\u7528\u65b9\u6cd5\u306f\u3001your_app/models.py\u306b\u4e0b\u8a18\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\n```python\nfrom django_conoha_objstorage.models import (\n BaseObjectStorage,\n get_upload_container,\n create_choice_tuple,\n )\n```\n\u305d\u308c\u305e\u308c\u306e\u6a5f\u80fd\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \n### BaseObjectStorage\nobject, container_name\u304c\u5b9f\u88c5\u3057\u3066\u3042\u308a\u307e\u3059\u3002\u9069\u5b9c\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002 \n\u5c1a\u3001\u3053\u306e\u30e2\u30c7\u30eb\u3092\u7d99\u627f\u3059\u308b\u3068\u30c7\u30fc\u30bf\u524a\u9664\u6642\u306b\u3001\u30d5\u30a1\u30a4\u30eb\u3082\u5408\u308f\u305b\u3066\u524a\u9664\u3057\u3066\u304f\u308c\u307e\u3059\u3002\uff08\u4e00\u62ec\u524a\u9664\u3092\u542b\u3080\uff09\n\n### get_upload_container\nobject\u306e`upload_to`\u306bcontainer_name\u306e\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002\u9069\u5b9c\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\n### create_choice_tuple\ncontainer_name\u306b`choice=create_choice_tuple`\u3092\u6307\u5b9a\u3059\u308b\u3068`swift list`\u3067\u8fd4\u3063\u3066\u304f\u308b\u30b3\u30f3\u30c6\u30ca\u306e\u30ea\u30b9\u30c8\u304b\u3089\u30bf\u30d7\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ni1mi213/django-conoha-objstorage", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "django-conoha-objstorage", "package_url": "https://pypi.org/project/django-conoha-objstorage/", "platform": "", "project_url": "https://pypi.org/project/django-conoha-objstorage/", "project_urls": { "Homepage": "https://github.com/ni1mi213/django-conoha-objstorage" }, "release_url": "https://pypi.org/project/django-conoha-objstorage/0.0.2/", "requires_dist": [ "python-keystoneclient", "python-swiftclient" ], "requires_python": "", "summary": "django-conoha-objectstorage: A package that uses ConohaObjectStorage with Django.", "version": "0.0.2" }, "last_serial": 5428257, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "71ddcb0511be007f3b5316bfdcd60854", "sha256": "7ea52534bd7ba08342e09fa88102e765e4260fb0555892599ddef37b52eb7657" }, "downloads": -1, "filename": "django_conoha_objstorage-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "71ddcb0511be007f3b5316bfdcd60854", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8566, "upload_time": "2019-06-21T01:16:51", "url": "https://files.pythonhosted.org/packages/46/5a/9d5082b9e557a31d0d0b33ebd67c9136dd3ec5873c180b075b305d5fc8a0/django_conoha_objstorage-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b2cab711558cc5e3495b27e55057991d", "sha256": "8a292f0c3ad6c1bbb78acbe8249dee7d88956a23d33b806f056dc5ff74e8c1ce" }, "downloads": -1, "filename": "django-conoha-objstorage-0.0.2.tar.gz", "has_sig": false, "md5_digest": "b2cab711558cc5e3495b27e55057991d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5757, "upload_time": "2019-06-21T01:16:52", "url": "https://files.pythonhosted.org/packages/95/31/ffa047353b49316f2427a2aef01d046861f627b7d5d3177f93f4298f0975/django-conoha-objstorage-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "71ddcb0511be007f3b5316bfdcd60854", "sha256": "7ea52534bd7ba08342e09fa88102e765e4260fb0555892599ddef37b52eb7657" }, "downloads": -1, "filename": "django_conoha_objstorage-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "71ddcb0511be007f3b5316bfdcd60854", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8566, "upload_time": "2019-06-21T01:16:51", "url": "https://files.pythonhosted.org/packages/46/5a/9d5082b9e557a31d0d0b33ebd67c9136dd3ec5873c180b075b305d5fc8a0/django_conoha_objstorage-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b2cab711558cc5e3495b27e55057991d", "sha256": "8a292f0c3ad6c1bbb78acbe8249dee7d88956a23d33b806f056dc5ff74e8c1ce" }, "downloads": -1, "filename": "django-conoha-objstorage-0.0.2.tar.gz", "has_sig": false, "md5_digest": "b2cab711558cc5e3495b27e55057991d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5757, "upload_time": "2019-06-21T01:16:52", "url": "https://files.pythonhosted.org/packages/95/31/ffa047353b49316f2427a2aef01d046861f627b7d5d3177f93f4298f0975/django-conoha-objstorage-0.0.2.tar.gz" } ] }