From 999dab40da76864c488471df6a825e1a25785ee3 Mon Sep 17 00:00:00 2001 From: "Leonardo J. Caballero G" <leonardocaballero@gmail.com> Date: Mon, 4 Jun 2012 12:10:16 -0430 Subject: [PATCH] First commit --- .gitignore | 2 + README.md | 4 -- README.rst | 49 ++++++++++++++ helloworld/__init__.py | 0 helloworld/settings.py | 146 +++++++++++++++++++++++++++++++++++++++++ helloworld/urls.py | 29 ++++++++ helloworld/views.py | 5 ++ setup.py | 38 +++++++++++ 8 files changed, 269 insertions(+), 4 deletions(-) delete mode 100644 README.md create mode 100644 README.rst create mode 100644 helloworld/__init__.py create mode 100644 helloworld/settings.py create mode 100644 helloworld/urls.py create mode 100644 helloworld/views.py create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index d9437c3..e0006c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ +*~ *.log *.pot *.pyc +*.pyo local_settings.py diff --git a/README.md b/README.md deleted file mode 100644 index 1bb9979..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -helloworld -========== - -A Djanfo hello world example \ No newline at end of file diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..6660735 --- /dev/null +++ b/README.rst @@ -0,0 +1,49 @@ +helloworld +========== + +A Djanfo hello world example + +Followed by:: + + $ bin/django syncdb + +At which point you should see:: + + Creating tables ... + Creating table auth_permission + Creating table auth_group_permissions + Creating table auth_group + Creating table auth_user_user_permissions + Creating table auth_user_groups + Creating table auth_user + Creating table auth_message + Creating table django_content_type + Creating table django_session + Creating table django_site + Creating table django_admin_log + +Followed by a prompt for your username and new password:: + + You just installed Django's auth system, which means you don't have any + superusers defined. + Would you like to create one now? (yes/no): yes + Username (Leave blank to use 'admin'): admin + E-mail address: YOUREMAIL@EMAILSERVICE + Password: + Password (again): + Superuser created successfully. + Installing custom SQL ... + Installing indexes ... + No fixtures found. + +After which you can run:: + + $ bin/django runserver + +And open the following URL in your web browser: + + - http://127.0.0.1:8000/admin/ + +And open the following URL in your web browser for see the hello world example: + + - http://127.0.0.1:8000/ diff --git a/helloworld/__init__.py b/helloworld/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/helloworld/settings.py b/helloworld/settings.py new file mode 100644 index 0000000..0c8749d --- /dev/null +++ b/helloworld/settings.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +# Django settings for helloworld project. + +import os + +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) + +MANAGERS = ADMINS + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'helloworld.db', # Or path to database file if using sqlite3. + 'USER': '', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + } +} + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# On Unix systems, a value of None will cause Django to use the same +# timezone as the operating system. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = 'America/Chicago' + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'en-us' + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale +USE_L10N = True + +# Absolute filesystem path to the directory that will hold user-uploaded files. +# Example: "/home/media/media.lawrence.com/media/" +MEDIA_ROOT = '' + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash. +# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" +MEDIA_URL = '' + +# Absolute path to the directory static files should be collected to. +# Don't put anything in this directory yourself; store your static files +# in apps' "static/" subdirectories and in STATICFILES_DIRS. +# Example: "/home/media/media.lawrence.com/static/" +STATIC_ROOT = '' + +# URL prefix for static files. +# Example: "http://media.lawrence.com/static/" +STATIC_URL = '/static/' + +# URL prefix for admin static files -- CSS, JavaScript and images. +# Make sure to use a trailing slash. +# Examples: "http://foo.com/static/admin/", "/static/admin/". +ADMIN_MEDIA_PREFIX = '/static/admin/' + +# Additional locations of static files +STATICFILES_DIRS = ( + # Put strings here, like "/home/html/static" or "C:/www/django/static". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. +) + +# List of finder classes that know how to find static files in +# various locations. +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +# 'django.contrib.staticfiles.finders.DefaultStorageFinder', +) + +# Make this unique, and don't share it with anybody. +SECRET_KEY = '0h@p1(0e%*b9r4k+dnpc+7s18lpap6+=cu^#^d=hll+38zv_)r' + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', +# 'django.template.loaders.eggs.Loader', +) + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', +) + +ROOT_URLCONF = 'helloworld.urls' + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + os.path.join(os.path.dirname(__file__), "templates"), +) + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.staticfiles', + # Uncomment the next line to enable the admin: + 'django.contrib.admin', + # Uncomment the next line to enable admin documentation: + 'django.contrib.admindocs', +) + +# A sample logging configuration. The only tangible logging +# performed by this configuration is to send an email to +# the site admins on every HTTP 500 error. +# See http://docs.djangoproject.com/en/dev/topics/logging for +# more details on how to customize your logging configuration. +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'class': 'django.utils.log.AdminEmailHandler' + } + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + } +} diff --git a/helloworld/urls.py b/helloworld/urls.py new file mode 100644 index 0000000..f880d35 --- /dev/null +++ b/helloworld/urls.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from django.conf.urls.defaults import * +from django.conf import settings + +# Uncomment the next two lines to enable the admin: +from django.contrib import admin +admin.autodiscover() + +urlpatterns = patterns('', + # Example: + # (r'^helloworld/', include('helloworld.foo.urls')), + + # Uncomment the admin/doc line below to enable admin documentation: + (r'^admin/doc/', include('django.contrib.admindocs.urls')), + + # Uncomment the next line to enable the admin: + (r'^admin/', include(admin.site.urls)), + + # Hello, world! + (r'', 'helloworld.views.index'), +) + +if settings.DEBUG: + urlpatterns += patterns('', + (r'^media/(?P<path>.*)$', 'django.views.static.serve', + {'document_root': settings.MEDIA_ROOT}), + ) + diff --git a/helloworld/views.py b/helloworld/views.py new file mode 100644 index 0000000..b0895dc --- /dev/null +++ b/helloworld/views.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +from django.http import HttpResponse + +def index(request): + return HttpResponse("Hello, world!") diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f964da2 --- /dev/null +++ b/setup.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +from setuptools import setup, find_packages +import os + +CLASSIFIERS = [ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Web Environment', + 'Framework :: Django', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: GNU General Public License (GPL)', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', + 'Topic :: Software Development', + 'Topic :: Software Development :: Libraries :: Application Frameworks', +] + +setup( + author="Alex Clark", + author_email="aclark@aclark.net", + maintainer='Leonardo J. Caballero G.', + maintainer_email='leonardocaballero@gmail.com', + name='helloworld', + version='0.1', + description='A Django hello world example ', + long_description=open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(), + url='https://github.com/django-ve/helloworld', + license='GPL', + platforms=['OS Independent'], + classifiers=CLASSIFIERS, + install_requires=[ + 'Django==1.4', + ], + packages=find_packages(exclude=["project","project.*"]), + include_package_data=True, + zip_safe = False +) -- GitLab