Заливка проекту на PYTHONANYWHERE
ЗАЛИВКА НА ПАЙТОНЕІВЕР
- створюємо консоль
- git clone in bash console
git clone https://github.com/BatyrbekCherushev/beetroot_project.git
- python environment setup:
python3 -m venv myenv
source myenv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
- u need to haverequirements.txt
in root project directory
<!-- requirements.txt -->
asgiref==3.9.1
diff-match-patch==20241021
Django==5.2.5
django-import-export==4.3.9
et_xmlfile==2.0.0
openpyxl==3.1.5
sqlparse==0.5.3
tablib==3.8.0
tzdata==2025.2
- в каталозі beetroot_project/project виконуємо
rm -rf static/*
для очищення папки з сатичним файлами python manage.py collectstatic
- для перезбірки статичних файлівpython manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
В панелі PythonAnywhere:
- Зайти у Web → Add a new web app
- Вибрати Manual configuration → Django
- Вказати шлях до свого проєкту (/home/username/beetroot_project/)
PYTHONANYWHERE -> WEB ->
- Source code:
/home/Heroesofwords/beetroot_project/project
- Working directory:
/home/Heroesofwords/
- WSGI SETTINGS:
# +++++++++++ DJANGO +++++++++++
# To use your own django app use code like this:
import os
import sys
#
## assuming your django settings file is at '/home/BatyrbekCherushev/mysite/mysite/settings.py'
## and your manage.py is is at '/home/BatyrbekCherushev/mysite/manage.py'
path = '/home/Heroesofwords/beetroot_project/project'
if path not in sys.path:
sys.path.append(path)
#
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
#
## then:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
- Python version:
3.13
- Virtualenv:
/home/Heroesofwords/beetroot_project/myenv
- Static files:
- URL
/static/
- Directory
/home/Heroesofwords/beetroot_project/project/static
- URL
- вкладка Files -> project -> project -> settings.py
import os
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 5.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/5.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.2/ref/settings/
"""
from pathlib import Path
# 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/5.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-#%dd-&t0w^)(&mgyb*pi-53k@n8b0pc+p*+eoiql)5(urnl-ba'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['heroesofwords.pythonanywhere.com',
'127.0.0.1',
'localhost']
# Application definition
INSTALLED_APPS = [
'mysite',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'import_export',
]
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 = 'project.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.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'project.wsgi.application'
# Database
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
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
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/5.2/topics/i18n/
LANGUAGE_CODE = 'uk'
TIME_ZONE = 'Europe/Kyiv'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# Default primary key field type
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LOGIN_URL = '/login/' # тут має бути шлях до твого логіну
LOGIN_REDIRECT_URL = '/' # куди редіректити після успішного логіну
LOGOUT_REDIRECT_URL = '/login/' # куди після логауту
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
import mimetypes
mimetypes.add_type("application/javascript", ".js", True)
# for IMPORT EXPORT SETTINGS
DATA_UPLOAD_MAX_NUMBER_FIELDS = 100000
* змінити параметр `DEBUG=False`
- вкладка WEB -> Натиснути Reload веб-додатка.
Налаштування проекту * В АДМІНЦІ ПРОЕКТУ: * імпортимо категорії * імпортимо підкатегорії * імпортимо профайли босів * імпортимо скіли * імпортимо екіпіровку * імпортимо англійський словник * імпортимо німецький словник