-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
management command to download static libraries locally, update README
- Loading branch information
1 parent
dfac4bb
commit 4c68901
Showing
3 changed files
with
44 additions
and
7 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 |
---|---|---|
|
@@ -16,7 +16,7 @@ where highlighted substrings overlap. character-by-character feedback | |
|
||
## Development Setup | ||
|
||
Requires Python 3. | ||
Developed on Python 3.4 (earlier Python 3s may or may not work). | ||
|
||
* Clone the repository: `git clone [email protected]:zackmdavis/Finetooth.git` | ||
|
||
|
@@ -26,16 +26,20 @@ Requires Python 3. | |
|
||
* Create a file called `.development` (the presence of this file is used to determine that we should use development rather than production-like Django settings): `touch .development` | ||
|
||
* Configure static files! | ||
|
||
* If you want to serve static JavaScripts and CSS locally, download them with `./manage.py download_statics`. | ||
|
||
* If you want to use CDNs, export a truthy "NONLOCAL_STATIC_LIBS" environment variable: `export NONLOCAL_STATIC_LIBS=1`. | ||
|
||
* Set up the database: `./manage.py migrate` | ||
|
||
* Run the tests! | ||
* *Optional*: run the tests maybe! | ||
|
||
* Django tests: `./manage.py test core` | ||
* Django tests: `./manage.py test` | ||
|
||
* JavaScript tests: | ||
|
||
- Get local copies of jQuery and Underscore: `wget http://code.jquery.com/jquery-2.1.1.min.js http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.map -P static/libs/` | ||
|
||
- `jasmine` | ||
|
||
- Visit *http://localhost:8888/* in your favorite browser! | ||
|
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,33 @@ | ||
import os | ||
from urllib.request import urlretrieve | ||
|
||
from django.core.management.base import BaseCommand, CommandError | ||
|
||
our_statics = { | ||
'jquery-2.1.1.min.js': "https://code.jquery.com/jquery-2.1.1.min.js", | ||
'underscore-min.js': ( | ||
"https://cdnjs.cloudflare.com/ajax/libs/" | ||
"underscore.js/1.7.0/underscore-min.js"), | ||
os.path.join('css', "bootstrap.min.css"): ( | ||
"https://netdna.bootstrapcdn.com/bootstrap/3.2.0/css/" | ||
"bootstrap.min.css"), | ||
os.path.join('fonts', "glyphicons-halflings-regular.woff"): ( | ||
"https://netdna.bootstrapcdn.com/bootstrap/3.2.0/fonts/" | ||
"glyphicons-halflings-regular.woff"), | ||
os.path.join('fonts', "glyphicons-halflings-regular.ttf"): ( | ||
"https://netdna.bootstrapcdn.com/bootstrap/3.2.0/fonts/" | ||
"glyphicons-halflings-regular.ttf"), | ||
'words': "http://www.cs.duke.edu/~ola/ap/linuxwords" | ||
} | ||
|
||
class Command(BaseCommand): | ||
|
||
def handle(self, *args, **options): | ||
for static, upstream in our_statics.items(): | ||
destination = os.path.join('static', 'libs', static) | ||
if not os.path.exists(destination): | ||
self.stdout.write("downloading {} from {} ...".format( | ||
destination, upstream)) | ||
urlretrieve(upstream, destination) | ||
else: | ||
self.stdout.write("we already have {}".format(static)) |
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