Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from nikhila05/initial_app
Browse files Browse the repository at this point in the history
Initial app
  • Loading branch information
nikhila05 committed Apr 10, 2017
2 parents ffbb0b4 + cde77aa commit aafac9a
Show file tree
Hide file tree
Showing 30 changed files with 398 additions and 44 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.pyc
*~
dist
build
django_webpacker.egg-info/
sample_project/node_modules/
sample_project/static/webpack_bundles/
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: python

python:
- "3.4"

install:
- python setup.py install
- pip install coveralls

script:
- coverage run --source=testapp sample_project/manage.py test

after_success:
coveralls
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include README.rst
recursive-include django_webpacker/management *
18 changes: 17 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
django-webpacker's documentation:
=====================================

#badges
.. image:: https://readthedocs.org/projects/django-webpacker/badge/?version=latest
:target: http://django-webpacker.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

.. image:: https://coveralls.io/repos/github/MicroPyramid/django-webpacker/badge.svg?branch=master
:target: https://coveralls.io/github/MicroPyramid/django-webpacker?branch=master

.. image:: https://travis-ci.org/MicroPyramid/django-webpacker.svg?branch=master
:target: https://travis-ci.org/MicroPyramid/django-webpacker

.. image:: https://landscape.io/github/MicroPyramid/django-webpacker/master/landscape.svg?style=flat
:target: https://landscape.io/github/MicroPyramid/django-webpacker/master
:alt: Code Health

.. image:: https://img.shields.io/github/license/micropyramid/django-webpacker.svg
:target: https://pypi.python.org/pypi/django-webpacker/


Introduction:
=============
Expand Down
Empty file.
2 changes: 0 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
django-webpacker's documentation:
=====================================

#badges

Introduction:
=============

Expand Down
22 changes: 22 additions & 0 deletions sample_project/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sample_project.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
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?"
)
raise
execute_from_command_line(sys.argv)
36 changes: 36 additions & 0 deletions sample_project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "sample_project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel": "^6.23.0",
"babel-core": "^6.24.0",
"babel-loader": "^6.4.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "^0.11.1",
"html-webpack-inline-source-plugin": "0.0.7",
"html-webpack-plugin": "^2.28.0",
"image-webpack-loader": "^3.3.0",
"less-loader": "^4.0.3",
"node-sass": "^4.5.2",
"react": "^15.4.2",
"react-hot-loader": "^1.3.1",
"sass-loader": "^6.0.3",
"script-loader": "^0.7.0",
"style-loader": "^0.16.1",
"webpack": "^2.3.3",
"webpack-bundle-tracker": "^0.2.0",
"webpack-dev-server": "^2.4.2"
},
"dependencies": {
"imports-loader": "^0.7.1",
"jquery": "^3.2.1"
}
}
3 changes: 3 additions & 0 deletions sample_project/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
boto==2.46.1
Django==1.9.13
django-webpacker==0.1.1
Empty file.
86 changes: 86 additions & 0 deletions sample_project/sample_project/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


SECRET_KEY = '8&=h22)%v2_ii66p30-6=3_v%(&ujs83q=l1@m^fd6#t&00tr&'

DEBUG = True

ALLOWED_HOSTS = []



INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_webpacker',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'sample_project.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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',
],
},
},
]

WSGI_APPLICATION = 'sample_project.wsgi.application'


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

STATIC_URL = '/static/'


STATIC_URL = '/static/'

STATICFILES_DIRS = (BASE_DIR + '/static',)


STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# other finders..
)

WEB_PACK_FILES = [
{'html_file_name': 'templates/index.html',
'webpack_js': 'index',
},
{'html_file_name': 'templates/login.html',
'webpack_js': 'login',
},
]

ENABLE_DJANGO_WEBPACK_S3_STORAGES = False
AWS_BUCKET_NAME = ''
24 changes: 24 additions & 0 deletions sample_project/sample_project/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""sample_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from testapp.views import *

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', index),
url(r'^login/$', login_page, name="login_page"),
]
16 changes: 16 additions & 0 deletions sample_project/sample_project/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for sample_project 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/1.10/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sample_project.settings")

application = get_wsgi_application()
6 changes: 6 additions & 0 deletions sample_project/static/css/login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
body{
color: #ddd;
}
a{
color: blue;
}
6 changes: 6 additions & 0 deletions sample_project/static/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
body{
color: #ddd;
}
a{
color: red;
}
3 changes: 3 additions & 0 deletions sample_project/static/js/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$('#login').click(function(e){
alert("click on login 123")
})
3 changes: 3 additions & 0 deletions sample_project/static/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$('#hello_world').click(function(e){
alert("click on hello world 123")
})
11 changes: 11 additions & 0 deletions sample_project/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Hello</title>
<link rel="stylesheet" type="text/css" href="/static/webpack_bundles/index-eae3e24342216ce07d17.css" id="packer_css"/>
</head>
<body>
<a id="hello_world">Hello world</a>
<script id="packer_js" src="/static/webpack_bundles/index-eae3e24342216ce07d17.js" type="text/javascript"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions sample_project/templates/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Hello</title>
<link rel="stylesheet" type="text/css" href="/static/webpack_bundles/login-eae3e24342216ce07d17.css" id="packer_css"/>
</head>
<body>
<a id="login">login</a>
<script id="packer_js" src="/static/webpack_bundles/login-eae3e24342216ce07d17.js" type="text/javascript"></script>
</body>
</html>
Empty file.
5 changes: 5 additions & 0 deletions sample_project/testapp/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class TestappConfig(AppConfig):
name = 'testapp'
Empty file.
11 changes: 11 additions & 0 deletions sample_project/testapp/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.core.management import call_command
from django.test import TestCase


class CommandsTestCase(TestCase):
def test_mycommand(self):
" Test my custom command."

args = []
opts = {}
call_command('compress_css_js_files', *args, **opts)
10 changes: 10 additions & 0 deletions sample_project/testapp/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.shortcuts import render

# Create your views here.

def index(request):
return render(request, 'index.html')


def login_page(request):
return render(request, 'login.html')
1 change: 1 addition & 0 deletions sample_project/webpack-stats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"status":"done","chunks":{"index":[{"name":"index-eae3e24342216ce07d17.js","path":"/home/nikhila/mp_projs/django_packer/django_web_packer/sample_project/static/webpack_bundles/index-eae3e24342216ce07d17.js"},{"name":"index-eae3e24342216ce07d17.css","path":"/home/nikhila/mp_projs/django_packer/django_web_packer/sample_project/static/webpack_bundles/index-eae3e24342216ce07d17.css"}],"login":[{"name":"login-eae3e24342216ce07d17.js","path":"/home/nikhila/mp_projs/django_packer/django_web_packer/sample_project/static/webpack_bundles/login-eae3e24342216ce07d17.js"},{"name":"login-eae3e24342216ce07d17.css","path":"/home/nikhila/mp_projs/django_packer/django_web_packer/sample_project/static/webpack_bundles/login-eae3e24342216ce07d17.css"}]}}

0 comments on commit aafac9a

Please sign in to comment.