This repository has been archived by the owner on Nov 5, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9144e9b
Showing
57 changed files
with
1,235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
*.pyc | ||
*.pyo | ||
*.swp | ||
*.orig | ||
*.kpf | ||
*.egg-info | ||
.project | ||
.pydevproject | ||
.DS_Store | ||
MANIFEST | ||
dist | ||
build | ||
dev.db | ||
local_settings.py | ||
eggs/* | ||
downloads/* | ||
.installed.cfg | ||
bin/* | ||
develop-eggs/*.egg-link | ||
docs/_build | ||
tests/project/site_media/static/* | ||
*.egg | ||
.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
language: python | ||
python: | ||
- "2.5" | ||
- "2.6" | ||
- "2.7" | ||
before_install: | ||
- export PIP_USE_MIRRORS=true | ||
- export PIP_INDEX_URL=https://simple.crate.io/ | ||
- export DJANGO_SETTINGS_MODULE=uploadstatic.test_settings | ||
install: | ||
- pip install -e . | ||
- pip install -r requirements/tests.txt Django==$DJANGO | ||
before_script: | ||
- flake8 uploadstatic --ignore=E501 | ||
script: | ||
- make test | ||
env: | ||
- DJANGO=1.2.7 | ||
- DJANGO=1.3.1 | ||
- DJANGO=1.4 | ||
branches: | ||
only: | ||
- master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Chris Streeter <chris@chrisstreeter.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright (c) 2012, Chris Streeter and contributors | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
* Neither the name of the author nor the names of other | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include AUTHORS | ||
include LICENSE | ||
include README.rst | ||
recursive-include docs * | ||
recursive-include uploadstatic/tests * | ||
global-exclude *.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test: | ||
coverage run --branch --source=uploadstatic `which django-admin.py` test --settings=uploadstatic.test_settings uploadstatic | ||
coverage report --omit=uploadstatic/test* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
=================== | ||
django-uploadstatic | ||
=================== | ||
|
||
This is a Django app that provides helpers for uploading static files. | ||
|
||
It is based off of `github.com/jezdez/django-staticfiles`_ | ||
but only uploads all the files in the collected `STATIC_ROOT` to S3 using | ||
the ``storages.backends.s3boto.S3BotoStorage`` storage backend in the | ||
``django-storages``. | ||
|
||
Installation | ||
------------ | ||
|
||
- Use your favorite Python packaging tool to install ``uploadstatic`` | ||
from `PyPI`_, e.g.:: | ||
|
||
pip install django-uploadstatic | ||
|
||
- Added ``"uploadstatic"`` to your ``INSTALLED_APPS`` setting:: | ||
|
||
INSTALLED_APPS = [ | ||
# ... | ||
"uploadstatic", | ||
] | ||
|
||
- Set your ``STATIC_URL`` setting to the URL that handles serving | ||
static files from S3:: | ||
|
||
STATIC_URL = "https://s3.amazonaws.com/some-domain/" | ||
|
||
- Once you are ready to upload all static files that have been collecte in your | ||
site's ``STATIC_ROOT``, use the ``uploadstatic`` management | ||
command:: | ||
|
||
python manage.py uploadstatic | ||
|
||
Then your files will be accessible from the ``STATIC_URL`` setting. | ||
|
||
.. _github.com/jezdez/django-staticfiles: http://github.com/jezdez/django-staticfiles | ||
.. _PyPI: http://pypi.python.org/pypi/django-uploadstatic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
flake8 | ||
django-discover-runner | ||
coverage | ||
unittest2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import os | ||
import re | ||
import sys | ||
from fnmatch import fnmatchcase | ||
from distutils.util import convert_path | ||
from setuptools import setup, find_packages | ||
|
||
|
||
def read(*parts): | ||
return open(os.path.join(os.path.dirname(__file__), *parts)).read() | ||
|
||
|
||
def find_version(*file_paths): | ||
version_file = read(*file_paths) | ||
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", | ||
version_file, re.M) | ||
if version_match: | ||
return version_match.group(1) | ||
raise RuntimeError("Unable to find version string.") | ||
|
||
# Provided as an attribute, so you can append to these instead | ||
# of replicating them: | ||
standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak') | ||
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build', | ||
'./dist', 'EGG-INFO', '*.egg-info') | ||
|
||
|
||
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) | ||
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php | ||
# Note: you may want to copy this into your setup.py file verbatim, as | ||
# you can't import this from another package, when you don't know if | ||
# that package is installed yet. | ||
def find_package_data( | ||
where='.', package='', | ||
exclude=standard_exclude, | ||
exclude_directories=standard_exclude_directories, | ||
only_in_packages=True, | ||
show_ignored=False): | ||
""" | ||
Return a dictionary suitable for use in ``package_data`` | ||
in a distutils ``setup.py`` file. | ||
The dictionary looks like:: | ||
{'package': [files]} | ||
Where ``files`` is a list of all the files in that package that | ||
don't match anything in ``exclude``. | ||
If ``only_in_packages`` is true, then top-level directories that | ||
are not packages won't be included (but directories under packages | ||
will). | ||
Directories matching any pattern in ``exclude_directories`` will | ||
be ignored; by default directories with leading ``.``, ``CVS``, | ||
and ``_darcs`` will be ignored. | ||
If ``show_ignored`` is true, then all the files that aren't | ||
included in package data are shown on stderr (for debugging | ||
purposes). | ||
Note patterns use wildcards, or can be exact paths (including | ||
leading ``./``), and all searching is case-insensitive. | ||
""" | ||
|
||
out = {} | ||
stack = [(convert_path(where), '', package, only_in_packages)] | ||
while stack: | ||
where, prefix, package, only_in_packages = stack.pop(0) | ||
for name in os.listdir(where): | ||
fn = os.path.join(where, name) | ||
if os.path.isdir(fn): | ||
bad_name = False | ||
for pattern in exclude_directories: | ||
if (fnmatchcase(name, pattern) | ||
or fn.lower() == pattern.lower()): | ||
bad_name = True | ||
if show_ignored: | ||
print >> sys.stderr, ( | ||
"Directory %s ignored by pattern %s" | ||
% (fn, pattern)) | ||
break | ||
if bad_name: | ||
continue | ||
if (os.path.isfile(os.path.join(fn, '__init__.py')) | ||
and not prefix): | ||
if not package: | ||
new_package = name | ||
else: | ||
new_package = package + '.' + name | ||
stack.append((fn, '', new_package, False)) | ||
else: | ||
stack.append((fn, prefix + name + '/', package, only_in_packages)) | ||
elif package or not only_in_packages: | ||
# is a file | ||
bad_name = False | ||
for pattern in exclude: | ||
if (fnmatchcase(name, pattern) | ||
or fn.lower() == pattern.lower()): | ||
bad_name = True | ||
if show_ignored: | ||
print >> sys.stderr, ( | ||
"File %s ignored by pattern %s" | ||
% (fn, pattern)) | ||
break | ||
if bad_name: | ||
continue | ||
out.setdefault(package, []).append(prefix + name) | ||
return out | ||
|
||
|
||
setup( | ||
name="django-uploadstatic", | ||
version=find_version("uploadstatic", "__init__.py"), | ||
description="A Django app that provides helpers for uploading static files.", | ||
long_description=read("README.rst"), | ||
author="Chris Streeter", | ||
author_email="chris@chrisstreeter.com", | ||
license="BSD", | ||
url="http://github.com/streeter/django-uploadstatic", | ||
packages=find_packages(), | ||
package_data=find_package_data(), | ||
classifiers=[ | ||
"Development Status :: 5 - Production/Stable", | ||
"Environment :: Web Environment", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: BSD License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
'Programming Language :: Python :: 2.5', | ||
'Programming Language :: Python :: 2.6', | ||
'Programming Language :: Python :: 2.7', | ||
"Framework :: Django", | ||
], | ||
zip_safe=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# following PEP 386 | ||
__version__ = "0.1.0" |
Empty file.
Empty file.
Oops, something went wrong.