Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ ENV/
# Rope project settings
.ropeproject

.idea
.DS_Store
*.sqlite3
*.sqlite3
30 changes: 15 additions & 15 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.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
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()
16 changes: 16 additions & 0 deletions mysite/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for mysite 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/4.0/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

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

application = get_asgi_application()
7 changes: 0 additions & 7 deletions mysite/photos/apps.py

This file was deleted.

9 changes: 0 additions & 9 deletions mysite/photos/forms.py

This file was deleted.

25 changes: 0 additions & 25 deletions mysite/photos/migrations/0001_initial.py

This file was deleted.

20 changes: 0 additions & 20 deletions mysite/photos/migrations/0002_auto_20161122_1248.py

This file was deleted.

9 changes: 0 additions & 9 deletions mysite/photos/models.py

This file was deleted.

10 changes: 0 additions & 10 deletions mysite/photos/urls.py

This file was deleted.

48 changes: 26 additions & 22 deletions mysite/settings.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
"""
Django settings for mysite project.

Generated by 'django-admin startproject' using Django 1.10.3.
Generated by 'django-admin startproject' using Django 4.0.4.

For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
https://docs.djangoproject.com/en/4.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
https://docs.djangoproject.com/en/4.0/ref/settings/
"""

import os
from pathlib import Path

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'i%06y2q&4l-!nv*8oolv470b!o)!xg*^9f7^d=q10#b$wd%c_e'
SECRET_KEY = 'django-insecure-5)$usgcd4vo=qfxb$-305ovth)1$jw9%64))$z$akmfnx=xuzv'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand All @@ -31,13 +32,14 @@
# Application definition

INSTALLED_APPS = [
'photos',

'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

'mysite.photos',
]

MIDDLEWARE = [
Expand All @@ -55,7 +57,7 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'mysite/templates')],
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand All @@ -72,18 +74,17 @@


# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases

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


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

AUTH_PASSWORD_VALIDATORS = [
{
Expand All @@ -102,27 +103,30 @@


# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
# https://docs.djangoproject.com/en/4.0/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/1.10/howto/static-files/
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = 'static/'

STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static/"),
]

STATIC_URL = '/static/'
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'mysite/static'),
)
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
6 changes: 3 additions & 3 deletions mysite/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from django.conf import settings
from django.conf.urls import url, include
from django.urls import path, include
from django.conf.urls.static import static
from django.views.generic import TemplateView


urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'),
url(r'^photos/', include('mysite.photos.urls', namespace='photos')),
path('', TemplateView.as_view(template_name='home.html'), name='home'),
path('photos/', include('photos.urls'), name='photos'),
]

if settings.DEBUG:
Expand Down
4 changes: 2 additions & 2 deletions mysite/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
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/
https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')

application = get_wsgi_application()
File renamed without changes.
3 changes: 3 additions & 0 deletions photos/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions photos/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class PhotosConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'photos'
36 changes: 36 additions & 0 deletions photos/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from django import forms

from .models import Photo, Feed, FeedFile



class PhotoForm(forms.ModelForm):
class Meta:
model = Photo
fields = ('file', )


# Upload NFT Collection Folder Form
class FeedModelForm(forms.ModelForm):
class Meta:
model = Feed
fields = ['directories']
widgets = {
'directories': forms.TextInput(attrs={
'id': "directories", 'hidden': '',
}),
}


class FileModelForm(forms.ModelForm):
class Meta:
model = FeedFile
fields = ['file']
widgets = {
'file': forms.ClearableFileInput(attrs={
'type': "file", 'name': 'files[]', 'multiple': '', 'directory': '', 'webkitdirectory': '',
'mozdirectory': '', 'id': "actual-btn",
'style': 'width: 0.1px; height: 0.1px; opacity: 0; overflow: hidden; position: absolute; z-index: -1;',
'onchange': 'selectFolder(event)',
}),
}
41 changes: 41 additions & 0 deletions photos/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated by Django 4.0.5 on 2022-06-02 17:01

from django.db import migrations, models
import django.db.models.deletion
import photos.models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Feed',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('directories', models.TextField(max_length=10000)),
],
),
migrations.CreateModel(
name='Photo',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(blank=True, max_length=255)),
('file', models.FileField(upload_to='photos/')),
('uploaded_at', models.DateTimeField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='FeedFile',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('base_dir', models.CharField(max_length=100)),
('file', models.FileField(upload_to=photos.models.upload_function)),
('feed', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='photos.feed')),
],
),
]
File renamed without changes.
Loading