{ "info": { "author": "Christian Bianciotto", "author_email": "bianciotto@bitcircle.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7" ], "description": "# django-static-sites\n\n*django-static-sites* is an easy to use *Django* app that allow you to create a static sites with the power of Django\ntemplate system. You can render an existing *Django* view by adding a decorator or you can create an empty project\noptimized for *django-static-sites* use. You can specify multiple configuration for multiple deploy type.\n\n[GitHub](https://github.com/ciotto/django-static-sites)\n\n\n## How to start\n\n1. install *django-static-sites* in your python path or in your *virtualenv* path\n(`pip install django-static-sites`) or (`pip install https://github.com/ciotto/django-static-sites/archive/master.zip`)\n2. create an empty optimized project by `django-static-admin startproject PROJECT_NAME` command\n3. move to the `PROJECT_NAME` folder and create site by `python manage.py startsite SITE_NAME` command\n4. migrate `python manage.py migrate`\n5. deploy `python manage.py deploy`\n6. start server `python manage.py runserver`\n7. enjoy it at [http://127.0.0.1:8000](http://127.0.0.1:8000) **:-)**\n\n\n## How to use\n\nIf you want to use the *Django* template system, you must to add a function in your `views.py` file and add the\n`@staticview` decorator:\n\n```python\n@staticview\ndef index(request):\n ctx = {'title': 'Hello world!'}\n\n return render_to_response('index.html', ctx, context_instance=RequestContext(request))\n```\n\nand the `index.html` template file in your templates folder:\n\n```html\n\n\n\n \n\n {{ title }}\n\n\n

{{ title }}

\n\n\n```\nWhen you deploy (`python manage.py deploy` or *autodeploy*), *django-static-sites* create the `index.html` using\n`index.html` template.\n\nIf you want to add an rendered javascript file, you can create a view:\n\n```python\n@staticview(path={'demo': 'asd/test.js', '': 'js/test.js'})\ndef js__test(request):\n\n ctx = {'title': 'Hello world!'}\n\n return render_to_response('test.js', ctx, context_instance=RequestContext(request))\n```\n\nand the relatine `test.js` template:\n\n```javascript\nvar text = '{{ title }}';\n\nalert(text);\n```\n\nThe `test.js` destination path are specified in `@staticview` decorator and is different for different deploy type so\nwe must add `'js_path': js__test.path.get(deploy_type=deploy_type)` in the `index.html` context. `deploy_type` are passed to the view\nfunctions if is declared. Now we can add the import line in the `index.html` file:\n\n```html\n\n```\n\nYou can see this and more samples in `staticsites/tests/samples` folder; you can launch the deploy server for this \nsamples by `manage.py runserver --settings staticsites.tests.samples.SAMPLE_NAME.settings` command.\n\n###### Other samples\n\n1. [Hello world](https://github.com/ciotto/django-static-sites/tree/master/staticsites/tests/samples/01_hello_world)\n2. [Hello world (with static)](https://github.com/ciotto/django-static-sites/tree/master/staticsites/tests/samples/02_hello_world)\n3. [AWS S3/CloudFront](https://github.com/ciotto/django-static-sites/tree/master/staticsites/tests/samples/03_aws)\n4. [AWS S3/CloudFront (multiple remote)](https://github.com/ciotto/django-static-sites/tree/master/staticsites/tests/samples/04_aws_multiple_deploy_type)\n5. [FTP](https://github.com/ciotto/django-static-sites/tree/master/staticsites/tests/samples/05_ftp)\n\n### Add to an existing project\n\nIf you want to integrate `django-static-sites` in existing project you must to:\n\n1. add `staticsites` in your INSTALLED_APPS (replace django.contrib.staticfiles)\n\nIf you want to use Django development server to serve the deployed static site:\n\n1. add this lines at your `url.py`\n\n```python\n# Serve default deploy folder as site root\nif settings.DEBUG:\n urlpatterns += [\n url(\n r'^(?:%s)?$' % get_default_index(deploy_type='dev'),\n serve,\n {\n 'document_root': get_deploy_root(deploy_type='dev'), 'path': get_default_index(deploy_type='dev')\n }\n ),\n url(\n r'^(?P.*)$',\n serve,\n {\n 'document_root': get_deploy_root(deploy_type='dev')\n }\n ),\n ]\n```\n\n\n## Remote deploy\n\n*django-static-sites* use the *Django* `Storage` system during the deploy procedure; by default the file are deployed \nlocally using `FileSystemStorage`, but you can use any other `Storage` with the correct settings. In the \n[AWS S3/CloudFront](https://github.com/ciotto/django-static-sites/tree/master/staticsites/tests/samples/03_aws) samples \nI use the [django-storages](https://django-storages.readthedocs.org/) AWS storage for deploying on Amazon S3 bucket. \n\n\n## ToDo\n\n*django-static-sites* is work-in-progres:\n\n* add automatic url pattern\n* ~~autodeploy~~\n* ~~static file optimization~~\n* revert deploy if fail\n* ~~GZip deployed files~~\n* ~~minify deployed files~~\n* ~~custom header for deployed files~~\n* ~~singe configuration constant as dictionary~~\n* ~~deploy on multiple remote~~\n* add param check and raise Exception\n* update tests\n* ~~dedicated *settings* module for sample~~\n* ~~add tutorials~~\n* ~~deploy admin console~~", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ciotto/django-static-sites", "keywords": "", "license": "GNU GENERAL PUBLIC LICENSE", "maintainer": "", "maintainer_email": "", "name": "django-static-sites", "package_url": "https://pypi.org/project/django-static-sites/", "platform": "", "project_url": "https://pypi.org/project/django-static-sites/", "project_urls": { "Homepage": "https://github.com/ciotto/django-static-sites" }, "release_url": "https://pypi.org/project/django-static-sites/0.0.7/", "requires_dist": null, "requires_python": "", "summary": "An easy to use Django app to make static site.", "version": "0.0.7" }, "last_serial": 4339201, "releases": { "0.0.6": [ { "comment_text": "", "digests": { "md5": "386da050f52668c2991b0fdde163a324", "sha256": "8892bdf5883a05136e5fd075bc079598b22616303e2d191eda0c1a9d20ea7298" }, "downloads": -1, "filename": "django-static-sites-0.0.6.tar.gz", "has_sig": false, "md5_digest": "386da050f52668c2991b0fdde163a324", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31591, "upload_time": "2018-10-04T06:56:14", "url": "https://files.pythonhosted.org/packages/c8/ad/c6ee3184a45970f3cddc7a11b3ff1a907fd21a018c87b0c46b9a986e293d/django-static-sites-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "7bd0ce3d681460fd37e856495e1b71f4", "sha256": "bb0ee8c856807734f42e2e5df0e0f0a84af5ba75b0c6231a4f22faff824a60b9" }, "downloads": -1, "filename": "django-static-sites-0.0.7.tar.gz", "has_sig": false, "md5_digest": "7bd0ce3d681460fd37e856495e1b71f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31599, "upload_time": "2018-10-04T06:59:41", "url": "https://files.pythonhosted.org/packages/21/8b/17054347b805046aae7a37411c9f17d10e4c3c30132327c8e105ce33a86e/django-static-sites-0.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7bd0ce3d681460fd37e856495e1b71f4", "sha256": "bb0ee8c856807734f42e2e5df0e0f0a84af5ba75b0c6231a4f22faff824a60b9" }, "downloads": -1, "filename": "django-static-sites-0.0.7.tar.gz", "has_sig": false, "md5_digest": "7bd0ce3d681460fd37e856495e1b71f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31599, "upload_time": "2018-10-04T06:59:41", "url": "https://files.pythonhosted.org/packages/21/8b/17054347b805046aae7a37411c9f17d10e4c3c30132327c8e105ce33a86e/django-static-sites-0.0.7.tar.gz" } ] }