Skip to content

Commit

Permalink
reorganize directory structure
Browse files Browse the repository at this point in the history
So, this was originally structured (and maybe it's the Django way,
since it was so easy to stumble into this configuration with the
standard `startproject` command??) so that the root of the repository
contained manage.py, my virtualenv stuff, and a Finetooth/ directory
where the actual code lives. But I feel like that's unnecessary
nesting: I want the root of the repository to be useful; having
manage.py and settings.py in the same directory makes sense to me. Of
course, moving stuff required changing a lot of module import paths,
too: I think I got it all, because I can retrieve models at the
manage.py shell and the site shows the posts again (and this project
doesn't really do anything else at this point).

(Oh, and I also just tested that I can make and apply a migration #2.)

Maybe the extra layer of nesting would have been useful for dependency
management? If my code is going to live in a "core" app, then
importing some other Python module that happens to be named "core"
would probably require some weird import logic hacking? But I can't
quite bring myself to care.
  • Loading branch information
zackmdavis committed Aug 24, 2014
1 parent 5e7bd9d commit c0df9b4
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 8 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Finetooth/core/views.py → core/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.shortcuts import render

from Finetooth.core.models import Post
from core.models import Post

def home(request):
posts = Post.objects.all()
Expand Down
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", "Finetooth.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")

from django.core.management import execute_from_command_line

Expand Down
10 changes: 5 additions & 5 deletions Finetooth/settings.py → settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
'Finetooth.core',
'core',
)

MIDDLEWARE_CLASSES = (
Expand All @@ -41,16 +41,16 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'Finetooth.urls'
ROOT_URLCONF = 'urls'

WSGI_APPLICATION = 'Finetooth.wsgi.application'
WSGI_APPLICATION = 'wsgi.application'

DATABASES = {
'default': {
# I <3 SQLite but maybe consider Postgres if/when deploying this
# somewhere
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'NAME': os.path.join('db.sqlite3'),
}
}

Expand All @@ -64,6 +64,6 @@

USE_TZ = True

TEMPLATE_DIRS = os.path.join(BASE_DIR, "Finetooth", "templates")
TEMPLATE_DIRS = "templates"

STATIC_URL = '/static/'
File renamed without changes.
2 changes: 1 addition & 1 deletion Finetooth/urls.py → urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
url(r'^$', 'Finetooth.core.views.home', name='home'),
url(r'^$', 'core.views.home', name='home'),
)
File renamed without changes.

0 comments on commit c0df9b4

Please sign in to comment.