diff --git a/.gitignore b/.gitignore index f719955..38eb404 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,142 @@ -# Byte-compiled / optimized / DLL files +.idea + +# Created by https://www.toptal.com/developers/gitignore/api/django,python,virtualenv +# Edit at https://www.toptal.com/developers/gitignore?templates=django,python,virtualenv + +### Django ### +*.log +*.pot +*.pyc __pycache__/ +local_settings.py +#*.sqlite3 +#db.sqlite3 +db.sqlite3-journal +media +#static +staticfiles +profile_images + +# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ +# in your Git repository. Update and uncomment the following line accordingly. +# /staticfiles/ + +# db.sqlite3 +### Django.Python Stack ### +# Byte-compiled / optimized / DLL files *.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +#dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo # Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py # Environments .env @@ -17,29 +147,141 @@ ENV/ env.bak/ venv.bak/ -# Media & Static Files -/media/* -/staticfiles/* +# Spyder project settings +.spyderproject +.spyproject +# Rope project settings +.ropeproject -# Cache & Temporary Files -*.swp -*.swo -*.swn -*.bak -*.tmp +# mkdocs documentation +/site -# Editor-specific files -*.kate-swp -*.backup -.vscode/ -.idea/ -.DS_Store -._* +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json -# migrations -# */migrations/0*.py -!*/migrations/__init__.py +# Pyre type checker +.pyre/ -# cursor -.cursor/* +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python ### +# Byte-compiled / optimized / DLL files + +# C extensions + +# Distribution / packaging + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. + +# Installer logs + +# Unit test / coverage reports + +# Translations + +# Django stuff: + +# Flask stuff: + +# Scrapy stuff: + +# Sphinx documentation + +# PyBuilder + +# Jupyter Notebook + +# IPython + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm + +# Celery stuff + +# SageMath parsed files + +# Environments + +# Spyder project settings + +# Rope project settings + +# mkdocs documentation + +# mypy + +# Pyre type checker + +# pytype static type analyzer + +# Cython debug symbols + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +### VirtualEnv ### +# Virtualenv +# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +pyvenv.cfg +pip-selfcheck.json + +# End of https://www.toptal.com/developers/gitignore/api/django,python,virtualenv + +.cursor diff --git a/_base/settings.py b/_base/settings.py index 7466d95..e9079ca 100644 --- a/_base/settings.py +++ b/_base/settings.py @@ -11,8 +11,6 @@ https://docs.djangoproject.com/en/5.2/ref/settings/ """ import os from pathlib import Path -from decouple import config -import dj_database_url # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -22,28 +20,16 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = config('DJANGO_SECRET_KEY', default="unsecure-secretkey-kjhsgfjsfgjsfgjsg") +SECRET_KEY = 'django-insecure-h!2hx$h=f6ktgdks!g2_*pg_s1nnuyk+j2yd*_x8r+3+3iyfy*' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = config('DEBUG', cast=bool, default=True) +DEBUG = True -# Allowed hosts -ALLOWED_HOSTS = [host for host in config("DJANGO_ALLOWED_HOSTS", default="").split() if host] +ALLOWED_HOSTS = [] -# URL scheme (http or https) -URL_SCHEME = config("URL_SCHEME", default="http") - - -# CSRF trusted origins (add both with and without port if you use a non-standard port) -CSRF_TRUSTED_ORIGINS = [] -for host in ALLOWED_HOSTS: - if host not in ("localhost", "127.0.0.1"): - CSRF_TRUSTED_ORIGINS.append(f"{URL_SCHEME}://{host}") - -# Generate base URL for absolute URLs (use first allowed host) -BASE_URL = f"{URL_SCHEME}://{ALLOWED_HOSTS[0]}" if ALLOWED_HOSTS else "http://localhost" # Application definition + INSTALLED_APPS = [ # ------ theme ------ # 'jazzmin', @@ -59,7 +45,6 @@ INSTALLED_APPS = [ # ------- third party apps ------- # 'simple_history', - 'django_extensions', # -------------------------------- # # ------- my apps ------- # @@ -111,20 +96,13 @@ WSGI_APPLICATION = '_base.wsgi.application' # Database # https://docs.djangoproject.com/en/5.2/ref/settings/#databases -DB_TYPE = config('DB_TYPE', default='sqlite').lower() - -if DB_TYPE == 'postgres': - DATABASES = { - 'default': dj_database_url.config(default=config('DATABASE_URL')) +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', } +} -else: - DATABASES = { - "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": BASE_DIR/"db.sqlite3", - } - } # Password validation # https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators @@ -161,15 +139,15 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) -STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') +# https://docs.djangoproject.com/en/5.2/howto/static-files/ +STATIC_ROOT = 'ss' +STATIC_URL = 'static/' STATICFILES_DIRS = [ - os.path.join(BASE_DIR, 'static'), + os.path.join(BASE_DIR, 'static') ] -# Media files MEDIA_URL = '/media/' -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +MEDIA_ROOT = BASE_DIR / 'media' # Default primary key field type # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..4408b15 Binary files /dev/null and b/db.sqlite3 differ diff --git a/liara.json b/liara.json index d421180..30e235f 100644 --- a/liara.json +++ b/liara.json @@ -1,14 +1,9 @@ { - "app": "meterplus", - "port": 80, - "team-id": "68822f40f04e5bc3027fc2b7", - "build": { - "location": "iran" - }, - "disks": [ - { - "name": "media", - "mountTo": "/usr/src/app/media" - } - ] -} + "app": "shafafiyat", + "port": 80, + "team-id": "68822f40f04e5bc3027fc2b7", + "build": { + "location": "iran" + }, + "disks": [] +} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index fec9df0..9192d5f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,10 @@ asgiref==3.9.1 -dj-database-url==3.0.1 Django==5.2.5 -django-extensions==4.1 django-jazzmin==3.0.1 django-simple-history==3.10.1 et_xmlfile==2.0.0 openpyxl==3.1.5 pillow==11.3.0 -psycopg2==2.9.10 -psycopg2-binary==2.9.10 -python-decouple==3.8 sqlparse==0.5.3 typing_extensions==4.15.0 utm==0.8.1