Skip to content

Commit

Permalink
Merge f5af3a2 into 113962c
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdkey committed Jun 6, 2020
2 parents 113962c + f5af3a2 commit b08fb73
Show file tree
Hide file tree
Showing 28 changed files with 301 additions and 262 deletions.
18 changes: 9 additions & 9 deletions .travis.yml
Expand Up @@ -4,25 +4,25 @@ language: python

matrix:
include:
- python: 3.6
env: TOXENV=py36-flake8
- python: 3.6
- python: 3.8
env: TOXENV=docs
- python: 3.8
env: TOXENV=coverage

- python: 3.6
env: TOXENV=py36-dj1.11
env: TOXENV=py36-dj2.2
- python: 3.6
env: TOXENV=py36-dj2.0
env: TOXENV=py36-dj3.0

- python: 3.7
env: TOXENV=py37-dj1.11
env: TOXENV=py37-dj2.2
- python: 3.7
env: TOXENV=py37-dj2.0
env: TOXENV=py37-dj3.0

- python: 3.8
env: TOXENV=py38-dj1.11
env: TOXENV=py38-dj2.2
- python: 3.8
env: TOXENV=py38-dj2.0
env: TOXENV=py38-dj3.0

install:
- pip install tox
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -2,3 +2,4 @@ include AUTHORS
include README.rst
include LICENSE.txt
recursive-include treenav/templates *
recursive-exclude example *
File renamed without changes.
16 changes: 16 additions & 0 deletions example/asgi.py
@@ -0,0 +1,16 @@
"""
ASGI config for example project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example.settings')

application = get_asgi_application()
69 changes: 51 additions & 18 deletions sample_project/settings.py → example/settings.py
@@ -1,25 +1,26 @@
"""
Django settings for sample_project.
Django settings for example project.
Generated by 'django-admin startproject' using Django 1.8.17.
Generated by 'django-admin startproject' using Django 3.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
https://docs.djangoproject.com/en/3.0/ref/settings/
"""

import os

PROJECT_ROOT = os.path.dirname(__file__)
PROJECT_PATH = os.path.dirname(PROJECT_ROOT)
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '4o2bd-s2cyz#cfyn4m@f6z)p_wzx3n-sv^!qk*^2jw*wd)1jzf'
SECRET_KEY = '%lam$s$t8t%8#@uk+fx=xm0x*@ccj5d0&z^8#ku4gb$lk@pfxt'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand All @@ -29,16 +30,16 @@

# Application definition

INSTALLED_APPS = (
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mptt',
'treenav',
)
'mptt',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
Expand All @@ -50,38 +51,59 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'sample_project.urls'
ROOT_URLCONF = 'example.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(PROJECT_ROOT, 'templates')],
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'treenav.context_processors.treenav_active',
],
},
},
]

WSGI_APPLICATION = 'example.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'treenav.db',
'NAME': os.path.join(BASE_DIR, 'treenav.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

Expand All @@ -95,6 +117,17 @@


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'


for settings_file in ['local_settings']:
try:
settings_module = __import__('{}.{}'.format('example', settings_file))
except ModuleNotFoundError:
continue
else:
print(f'loading {settings_file}')
settings_module = getattr(settings_module, settings_file)
settings_module.apply_settings(globals())
27 changes: 27 additions & 0 deletions example/urls.py
@@ -0,0 +1,27 @@
"""example URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.views.generic import TemplateView
from django.urls import path, include


urlpatterns = [
path('admin/', admin.site.urls),
path('treenav/', include('treenav.urls')),
# Catch all URL to easily demonstrate treenav display
path('<path:resource>', TemplateView.as_view(template_name='base.html')),
path('', TemplateView.as_view(template_name='base.html')),
]
16 changes: 16 additions & 0 deletions example/wsgi.py
@@ -0,0 +1,16 @@
"""
WSGI config for example project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example.settings')

application = get_wsgi_application()
21 changes: 21 additions & 0 deletions manage.py
@@ -0,0 +1,21 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()
2 changes: 2 additions & 0 deletions requirements.txt
@@ -0,0 +1,2 @@
django>=2.2
django-mptt>=0.11.0
70 changes: 0 additions & 70 deletions runtests.py

This file was deleted.

10 changes: 0 additions & 10 deletions sample_project/manage.py

This file was deleted.

2 changes: 0 additions & 2 deletions sample_project/requirements.txt

This file was deleted.

12 changes: 0 additions & 12 deletions sample_project/urls.py

This file was deleted.

13 changes: 5 additions & 8 deletions setup.py
Expand Up @@ -5,7 +5,7 @@
version=__import__('treenav').__version__,
author='Caktus Consulting Group',
author_email='solutions@caktusgroup.com',
packages=find_packages(exclude=['sample_project']),
packages=find_packages(exclude=['example']),
include_package_data=True,
url='https://github.com/caktus/django-treenav',
license='BSD',
Expand All @@ -17,18 +17,15 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Software Development :: Libraries :: Python Modules',
'Development Status :: 5 - Production/Stable',
'Operating System :: OS Independent',
],
long_description=open('README.rst').read(),
install_requires=[
"django-mptt>=0.8.6,<1.0",
"django-mptt>=0.11.0",
],
)
File renamed without changes.
File renamed without changes.

0 comments on commit b08fb73

Please sign in to comment.