From 804938cd6e19deda427914bc521afc66d86e6a35 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 2 Mar 2019 12:04:27 +0100 Subject: [PATCH] Initial commit --- Pipfile | 12 ++++ Pipfile.lock | 36 ++++++++++ friends_map/__init__.py | 0 friends_map/settings.py | 125 +++++++++++++++++++++++++++++++++ friends_map/urls.py | 21 ++++++ friends_map/wsgi.py | 16 +++++ manage.py | 15 ++++ map/__init__.py | 0 map/admin.py | 5 ++ map/apps.py | 5 ++ map/migrations/0001_initial.py | 44 ++++++++++++ map/migrations/__init__.py | 0 map/models.py | 10 +++ map/tests.py | 3 + map/views.py | 3 + 15 files changed, 295 insertions(+) create mode 100644 Pipfile create mode 100644 Pipfile.lock create mode 100644 friends_map/__init__.py create mode 100644 friends_map/settings.py create mode 100644 friends_map/urls.py create mode 100644 friends_map/wsgi.py create mode 100755 manage.py create mode 100644 map/__init__.py create mode 100644 map/admin.py create mode 100644 map/apps.py create mode 100644 map/migrations/0001_initial.py create mode 100644 map/migrations/__init__.py create mode 100644 map/models.py create mode 100644 map/tests.py create mode 100644 map/views.py diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..8a20dc9 --- /dev/null +++ b/Pipfile @@ -0,0 +1,12 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +django = "*" + +[dev-packages] + +[requires] +python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..fd03c48 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,36 @@ +{ + "_meta": { + "hash": { + "sha256": "627ef89f247ecee27e9ef0dabe116108d09c47abf171c900a8817befa64f9dd2" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.7" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "django": { + "hashes": [ + "sha256:275bec66fd2588dd517ada59b8bfb23d4a9abc5a362349139ddda3c7ff6f5ade", + "sha256:939652e9d34d7d53d74d5d8ef82a19e5f8bb2de75618f7e5360691b6e9667963" + ], + "index": "pypi", + "version": "==2.1.7" + }, + "pytz": { + "hashes": [ + "sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9", + "sha256:d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c" + ], + "version": "==2018.9" + } + }, + "develop": {} +} diff --git a/friends_map/__init__.py b/friends_map/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/friends_map/settings.py b/friends_map/settings.py new file mode 100644 index 0000000..61a2185 --- /dev/null +++ b/friends_map/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for friends_map project. + +Generated by 'django-admin startproject' using Django 2.1.7. + +For more information on this file, see +https://docs.djangoproject.com/en/2.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.1/ref/settings/ +""" + +import os + +# 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/2.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '(b_w%!e9u!3q=d-u!$g6ntpzh-=4mo$gs#96as+^179vp6stui' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'map', +] + +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 = 'friends_map.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + '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', + ], + }, + }, +] + +WSGI_APPLICATION = 'friends_map.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/2.1/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/2.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/2.1/howto/static-files/ + +STATIC_URL = '/static/' + +AUTH_USER_MODEL = 'map.Friend' + diff --git a/friends_map/urls.py b/friends_map/urls.py new file mode 100644 index 0000000..6efa96b --- /dev/null +++ b/friends_map/urls.py @@ -0,0 +1,21 @@ +"""friends_map URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/2.1/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.urls import path + +urlpatterns = [ + path('admin/', admin.site.urls), +] diff --git a/friends_map/wsgi.py b/friends_map/wsgi.py new file mode 100644 index 0000000..4dc2bd1 --- /dev/null +++ b/friends_map/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for friends_map 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/2.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'friends_map.settings') + +application = get_wsgi_application() diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..25a32e8 --- /dev/null +++ b/manage.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == '__main__': + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'friends_map.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) diff --git a/map/__init__.py b/map/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/map/admin.py b/map/admin.py new file mode 100644 index 0000000..50cd130 --- /dev/null +++ b/map/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin +from django.contrib.auth.admin import UserAdmin +from .models import Friend + +admin.site.register(Friend, UserAdmin) diff --git a/map/apps.py b/map/apps.py new file mode 100644 index 0000000..fb66c9b --- /dev/null +++ b/map/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class MapConfig(AppConfig): + name = 'map' diff --git a/map/migrations/0001_initial.py b/map/migrations/0001_initial.py new file mode 100644 index 0000000..5d49ff7 --- /dev/null +++ b/map/migrations/0001_initial.py @@ -0,0 +1,44 @@ +# Generated by Django 2.1.7 on 2019-03-02 11:03 + +import django.contrib.auth.models +import django.contrib.auth.validators +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('auth', '0009_alter_user_last_name_max_length'), + ] + + operations = [ + migrations.CreateModel( + name='Friend', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), + ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')), + ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), + ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), + ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), + ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), + ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), + ], + options={ + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, + }, + managers=[ + ('objects', django.contrib.auth.models.UserManager()), + ], + ), + ] diff --git a/map/migrations/__init__.py b/map/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/map/models.py b/map/models.py new file mode 100644 index 0000000..fa8f7ec --- /dev/null +++ b/map/models.py @@ -0,0 +1,10 @@ +from django.contrib.auth.models import AbstractUser +from django.db import models + + +class Friend(AbstractUser): + pass + + +# class Location(models.Model): +# latitude = models. diff --git a/map/tests.py b/map/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/map/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/map/views.py b/map/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/map/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.