Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Commit

Permalink
revert to starting point for workshop
Browse files Browse the repository at this point in the history
  • Loading branch information
CaseyFaist committed May 1, 2019
1 parent 5421092 commit 6f906b1
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 79 deletions.
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
/djangowiki
.vscode/
__pycache__
db.sqlite3
dynowiki/static/admin/
dynowiki/static/mptt/
dynowiki/static/wiki/
dynowiki/static/staticfiles.json
media/
dynowiki/static/
.vscode/
2 changes: 0 additions & 2 deletions Procfile

This file was deleted.

17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,18 @@ With that in mind, here are the specific changes needed to get a locally running
[ ] Install the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli#download-and-install)
[ ] Clone this Repo

## Step 1: Create a .gitignore
## Step 1: Update the .gitignore

This will enable you to smoothly run your application locally and in production with minimal headache.

In addition to whatever you'd normally place in your .gitignore, be sure to
[untrack](https://git-scm.com/docs/git-rm#Documentation/git-rm.txt---cached) the following files:
In addition to whatever you'd normally place in your .gitignore, be sure to [untrack](https://git-scm.com/docs/git-rm#Documentation/git-rm.txt---cached) the following files.

```
/your-venv-directory
/your-venv-directory # Learn how to create a local environment in LOCALSETUP.md
__pycache__
db.sqlite3 # not needed if you're using Postgres locally
yourapp/static/admin/
yourapp/static/mptt/ # these are generated by django-wiki but it's better
yourapp/static/wiki/ # they be generated on deploy
yourapp/static/staticfiles.json
media/
static/
yourapp/static/
```

>note: Don't add your migrations to .gitignore! We're not covering any app
Expand Down Expand Up @@ -267,9 +262,9 @@ This assumes you're using Bucketeer, but the changes are quite similar if you've

Example updated from [this Stack Overflow post](https://stackoverflow.com/questions/19915116/setting-django-to-serve-media-files-from-amazon-s3), a nicely straightforward overview.

First, add the dependencies boto3 and [django-storages](https://django-storages.readthedocs.io/en/1.7.1/backends/amazon-S3.html) to your `requirements.txt`
First, if you look in your `requirements.txt`, you'll see the dependencies `boto3` and [django-storages](https://django-storages.readthedocs.io/en/1.7.1/backends/amazon-S3.html). We'll need both of them to connect to S3. If you're working in your own project, pip install these packages.

Then, add a file `s3utils.py` to your project inside the `myproject` directory - in this project, it should be inside `dynowiki/`
Next, add a file `s3utils.py` to your project inside the `myproject` directory - in this project, it should be inside `dynowiki/`

```
from storages.backends.s3boto3 import S3Boto3Storage
Expand Down
3 changes: 0 additions & 3 deletions dynowiki/s3utils.py

This file was deleted.

7 changes: 1 addition & 6 deletions dynowiki/settings/local.py → dynowiki/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware', # must be 2nd
# Whitenoise goes here
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
Expand Down Expand Up @@ -149,8 +149,3 @@
# dyno reboot, ie daily + with every deployment or config var change
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")


# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
46 changes: 0 additions & 46 deletions dynowiki/settings/heroku.py

This file was deleted.

2 changes: 1 addition & 1 deletion dynowiki/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dynowiki.settings.local')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dynowiki.settings')

application = get_wsgi_application()
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dynowiki.settings.local')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dynowiki.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down

0 comments on commit 6f906b1

Please sign in to comment.