mirror of
				https://github.com/bspeice/Melodia
				synced 2025-11-04 02:10:42 -05:00 
			
		
		
		
	Initial web app commit
Contains app-specific URL handling, and initial static resources (bootstrap, jquery 1.9, jquery-ui 1.10 included)
This commit is contained in:
		@ -60,7 +60,7 @@ MEDIA_URL = ''
 | 
				
			|||||||
# Don't put anything in this directory yourself; store your static files
 | 
					# Don't put anything in this directory yourself; store your static files
 | 
				
			||||||
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
 | 
					# in apps' "static/" subdirectories and in STATICFILES_DIRS.
 | 
				
			||||||
# Example: "/home/media/media.lawrence.com/static/"
 | 
					# Example: "/home/media/media.lawrence.com/static/"
 | 
				
			||||||
STATIC_ROOT = ''
 | 
					STATIC_ROOT = '/tmp/MELODIA_STATIC/'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# URL prefix for static files.
 | 
					# URL prefix for static files.
 | 
				
			||||||
# Example: "http://media.lawrence.com/static/"
 | 
					# Example: "http://media.lawrence.com/static/"
 | 
				
			||||||
@ -130,6 +130,7 @@ TEMPLATE_DIRS = (
 | 
				
			|||||||
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
 | 
					    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
 | 
				
			||||||
    # Always use forward slashes, even on Windows.
 | 
					    # Always use forward slashes, even on Windows.
 | 
				
			||||||
    # Don't forget to use absolute paths, not relative paths.
 | 
					    # Don't forget to use absolute paths, not relative paths.
 | 
				
			||||||
 | 
						os.path.join(PROJECT_FOLDER, 'web', 'templates')
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INSTALLED_APPS = (
 | 
					INSTALLED_APPS = (
 | 
				
			||||||
@ -146,6 +147,7 @@ INSTALLED_APPS = (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# Melodia apps
 | 
						# Melodia apps
 | 
				
			||||||
	'archiver',
 | 
						'archiver',
 | 
				
			||||||
 | 
						'web',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	#Django management
 | 
						#Django management
 | 
				
			||||||
	'django_extensions',
 | 
						'django_extensions',
 | 
				
			||||||
 | 
				
			|||||||
@ -4,6 +4,9 @@ from django.conf.urls import patterns, include, url
 | 
				
			|||||||
from django.contrib import admin
 | 
					from django.contrib import admin
 | 
				
			||||||
admin.autodiscover()
 | 
					admin.autodiscover()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Melodia web client
 | 
				
			||||||
 | 
					from web.urls import web_urls
 | 
				
			||||||
 | 
					
 | 
				
			||||||
urlpatterns = patterns('',
 | 
					urlpatterns = patterns('',
 | 
				
			||||||
    # Examples:
 | 
					    # Examples:
 | 
				
			||||||
    # url(r'^$', 'Melodia.views.home', name='home'),
 | 
					    # url(r'^$', 'Melodia.views.home', name='home'),
 | 
				
			||||||
@ -14,4 +17,7 @@ urlpatterns = patterns('',
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # Uncomment the next line to enable the admin:
 | 
					    # Uncomment the next line to enable the admin:
 | 
				
			||||||
    url(r'^admin/', include(admin.site.urls)),
 | 
					    url(r'^admin/', include(admin.site.urls)),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# Defer handling urls to the web_urls controller
 | 
				
			||||||
 | 
						url('', include(web_urls)),
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4742
									
								
								bootstrap.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4742
									
								
								bootstrap.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										0
									
								
								web/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								web/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										3
									
								
								web/models.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								web/models.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					from django.db import models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Create your models here.
 | 
				
			||||||
							
								
								
									
										4742
									
								
								web/static/bootstrap.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4742
									
								
								web/static/bootstrap.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1
									
								
								web/static/bootstrap.min.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								web/static/bootstrap.min.css
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										4
									
								
								web/static/jquery-1.9.0.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								web/static/jquery-1.9.0.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										6
									
								
								web/static/jquery-ui-1.10.0.custom.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								web/static/jquery-ui-1.10.0.custom.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										20
									
								
								web/templates/login.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								web/templates/login.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					<html>
 | 
				
			||||||
 | 
					    <head>
 | 
				
			||||||
 | 
					        <meta charset="utf-8" />
 | 
				
			||||||
 | 
					        <title>Login to Melodia</title>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							<link href="{{ STATIC_URL }}bootstrap.css" rel="stylesheet">
 | 
				
			||||||
 | 
					    </head>
 | 
				
			||||||
 | 
						<body>
 | 
				
			||||||
 | 
						    <div class="navbar navbar-inverse navbar-fixed-top">
 | 
				
			||||||
 | 
						        <div class="navbar-inner">
 | 
				
			||||||
 | 
						            <div class="container">
 | 
				
			||||||
 | 
						                <a data-toggle="collapse" data-target=".nav-collapse" class="btn btn-navbar"></a>
 | 
				
			||||||
 | 
						            </div>
 | 
				
			||||||
 | 
						        </div>
 | 
				
			||||||
 | 
						    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							<!-- Apparently putting javascript at the bottom makes it load faster... -->
 | 
				
			||||||
 | 
							<!-- Also, this is the login page... -->
 | 
				
			||||||
 | 
						</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
							
								
								
									
										19
									
								
								web/templates/main.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								web/templates/main.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					<html>
 | 
				
			||||||
 | 
					    <head>
 | 
				
			||||||
 | 
					        <meta charset="utf-8" />
 | 
				
			||||||
 | 
					        <title>Login to Melodia</title>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							<link href="{{ STATIC_URL }}bootstrap.css" rel="stylesheet">
 | 
				
			||||||
 | 
					    </head>
 | 
				
			||||||
 | 
						<body>
 | 
				
			||||||
 | 
						    <div class="navbar navbar-inverse navbar-fixed-top">
 | 
				
			||||||
 | 
						        <div class="navbar-inner">
 | 
				
			||||||
 | 
						            <div class="container">
 | 
				
			||||||
 | 
						                <a data-toggle="collapse" data-target=".nav-collapse" class="btn btn-navbar"></a>
 | 
				
			||||||
 | 
						            </div>
 | 
				
			||||||
 | 
						        </div>
 | 
				
			||||||
 | 
						    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							<!-- Apparently putting javascript at the bottom makes it load faster... -->
 | 
				
			||||||
 | 
						</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
							
								
								
									
										16
									
								
								web/tests.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								web/tests.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					"""
 | 
				
			||||||
 | 
					This file demonstrates writing tests using the unittest module. These will pass
 | 
				
			||||||
 | 
					when you run "manage.py test".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Replace this with more appropriate tests for your application.
 | 
				
			||||||
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from django.test import TestCase
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class SimpleTest(TestCase):
 | 
				
			||||||
 | 
					    def test_basic_addition(self):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Tests that 1 + 1 always equals 2.
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        self.assertEqual(1 + 1, 2)
 | 
				
			||||||
							
								
								
									
										10
									
								
								web/urls.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								web/urls.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					from django.conf.urls import patterns, include, url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					web_urls = patterns('web.views',
 | 
				
			||||||
 | 
					    # Examples:
 | 
				
			||||||
 | 
					    # url(r'^$', 'Melodia.views.home', name='home'),
 | 
				
			||||||
 | 
					    # url(r'^Melodia/', include('Melodia.foo.urls')),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						url(r'^$|main/', 'main.main'),
 | 
				
			||||||
 | 
						url(r'^login/', 'login_page.login_page'),
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
							
								
								
									
										0
									
								
								web/views/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								web/views/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										6
									
								
								web/views/login_page.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								web/views/login_page.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					from django.http import HttpResponse
 | 
				
			||||||
 | 
					from django.template import RequestContext
 | 
				
			||||||
 | 
					from django.shortcuts import render_to_response
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def login_page(request):
 | 
				
			||||||
 | 
						return render_to_response("login.html", context_instance = RequestContext(request))
 | 
				
			||||||
							
								
								
									
										6
									
								
								web/views/main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								web/views/main.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					from django.http import HttpResponse
 | 
				
			||||||
 | 
					from django.template import RequestContext
 | 
				
			||||||
 | 
					from django.shortcuts import render_to_response
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def main(request):
 | 
				
			||||||
 | 
						return render_to_response("main.html", context_instance = RequestContext(request))
 | 
				
			||||||
		Reference in New Issue
	
	Block a user