class ModelOneSerializer(serializers.ModelSerializer):
model_two = ModelTwo(read_only=True, many=True)
class Meta:
model = ModelOne
fields = ("id", "model_two")
CELERY_BEAT_SCHEDULE = {
'task_name': {
'task': 'app.module.task_name',
'schedule': timezone.timedelta(minutes=1),
}
}
from celery import shared_task
@shared_task
def task_name(*args, **kwargs):
pass
celery beat -A app_name -l info
MEDIA_ROOT = os.path.join(BASE_DIR, "media/")
MEDIA_URL = '/media/'
urlpatterns = + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
server {
listen 80;
server_name www.fasad.biz, fazad.bit;
return 301 https://fazad.bit$request_uri;
}
class M2M(models.Model):
developer = models.ForeignKey('Developer', on_delete=models.CASCADE)
project = models.ForeignKey('Project', on_delete=models.CASCADE)
class Meta:
db_table = "m2m"
class DataDetailSerializer(serializers.HyperlinkedModelSerializer):
item = ItemSerializer()
data = DataSerializer()
class Meta:
model = DataDetail
fields = ('data', 'name', 'data')
http {
upstream server1 {
server unix:///home/.../server1.sock;
}
upstream server2 {
server unix:///home/.../server2.sock;
}
server {
listen 80;
server_name server1.ru;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
uwsgi_pass server1;
include /etc/nginx/uwsgi_params;
}
}
server {
listen 80;
server_name server2.ru;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
uwsgi_pass server2;
include /etc/nginx/uwsgi_params;
}
}
}
if request.method == 'POST:
if request.POST:
if request.POST['something_field']:
something_actions...