Updated uwsgi.ini

This commit is contained in:
Phil Zhitnikov 2023-07-06 16:56:29 +04:00
parent 3e05f6f280
commit f80424f90e
6 changed files with 23 additions and 4 deletions

View File

@ -8,7 +8,7 @@ chdir = /var/www/phzhik-poizonstore/
# Django's wsgi file
module = vba_portal:application
# the virtualenv (full path)
;virtualenv = /var/www/phzhik-poizonstore/env
virtualenv = /var/www/phzhik-poizonstore/env
# process-related settings
# master

8
create_preview.py Normal file
View File

@ -0,0 +1,8 @@
from store.utils import create_preview
for i in range(1, 5):
order_id = f'result{i}'
image = create_preview(f'source{i}.jpeg', size=40, price_rub=100, title='Adidas Originals')
image.save(f'{order_id}.jpg')

View File

@ -10,3 +10,6 @@ Pillow==9.5.0
tqdm==4.65.0
django-debug-toolbar==4.1.0
requests==2.31.0
# Deployment
uWSGI==2.0.21

BIN
source3.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -130,11 +130,19 @@ class User(AbstractUser):
return concat_not_null_values(self.last_name, self.first_name, self.middle_name)
class PromocodeQuerySet(models.QuerySet):
def active(self):
return self.filter(is_active=True)
class Promocode(models.Model):
name = models.CharField('Название', max_length=100, unique=True)
discount = models.DecimalField('Скидка', max_digits=10, decimal_places=2,)
free_delivery = models.BooleanField('Бесплатная доставка', default=False) # freedelivery
no_comission = models.BooleanField('Без комиссии', default=False) # nocomission
is_active = models.BooleanField('Активен', default=True)
objects = PromocodeQuerySet.as_manager()
def __str__(self):
return self.name
@ -271,7 +279,7 @@ class Checklist(models.Model):
# TODO: choose from Promocode table
# promo
promocode = models.CharField('Промокод', max_length=100, null=True, blank=True)
promocode = models.ForeignKey('Promocode', verbose_name='Промокод', on_delete=models.PROTECT, null=True, blank=True)
comment = models.CharField('Комментарий', max_length=200, null=True, blank=True)
# buyername

View File

@ -72,8 +72,8 @@ class ChecklistSerializer(serializers.ModelSerializer):
# image = Base64ImageField(source='images', many=True, queryset=Image.objects.all())
previewimage = serializers.ImageField(source='preview_image_url', read_only=True)
# TODO: choose from Promocode table
promo = serializers.CharField(source='promocode', required=False)
promo = serializers.SlugRelatedField(source='promocode', slug_field='name',
queryset=Promocode.objects.active(), required=False)
currency = serializers.SerializerMethodField('get_yuan_rate')
curencycurency2 = serializers.DecimalField(source='price_yuan', max_digits=10, decimal_places=2)