This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import xml.etree.cElementTree as et | |
| from io import BytesIO | |
| from django.core.exceptions import ValidationError | |
| from django.core.validators import ( | |
| FileExtensionValidator, | |
| get_available_image_extensions, | |
| ) | |
| from django.forms import ImageField as DjangoImageField |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if DEBUG: | |
| EMAIL_HOST = 'localhost' | |
| EMAIL_PORT = 1025 | |
| EMAIL_HOST_USER = '' | |
| EMAIL_HOST_PASSWORD = '' | |
| EMAIL_USE_TLS = False | |
| DEFAULT_FROM_EMAIL = '[email protected]' |
- Изменить имя поля в модели (но запомнить старое имя для 3 шага!)
- Создать пустую миграцию
$ python manage.py makemigrations --empty myApp
- Отредактировать новый файл пустой миграции он находится в папке миграции в папке вашего приложения и будет последней миграцией) добавив:
operations = [
migrations.RenameField('MyModel', 'old_field_name', 'new_field_name'),
]
Шаг 1: отредактируйте соответствующие имена полей в models.py
class Bar(models.Model):
name = models.CharField(unique=True, max_length=32)
description = models.TextField(null=True, blank=True)
class AnotherModel(models.Model):
bar = models.ForeignKey(Bar) # <-- changed field name
is_awesome = models.BooleanField()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM nginx:alpine | |
| # stock verison from php:alpine image | |
| # ensure www-data user exists | |
| RUN set -x \ | |
| && addgroup -g 82 -S www-data \ | |
| && adduser -u 82 -D -S -G www-data www-data | |
| # 82 is the standard uid/gid for "www-data" in Alpine | |
| # http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:core'; | |
| import 'dart:async'; | |
| import 'dart:io'; | |
| void startServer() { | |
| Future<ServerSocket> serverFuture = ServerSocket.bind('0.0.0.0', 55555); | |
| serverFuture.then((ServerSocket server) { | |
| server.listen((Socket socket) { | |
| socket.listen((List<int> data) { | |
| String result = new String.fromCharCodes(data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #-*- coding: utf-8 -*- | |
| import subprocess | |
| if __name__ == '__main__': | |
| ps = subprocess.Popen(['nodejs','ps2.js'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) | |
| out = ps.communicate(input='http://www.daum.net'.encode())[0] | |
| print(out.decode('utf-8')) |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream