$scope.choiceFile = () ->
partsName = $scope.file.name.split('.')
partsName.pop()
$scope.file.humanName = partsName.join('.')
$scope.file = _.extend $scope.file,
progress: 0
isUploading: false
isError: false
isComplete: false
$scope.uploadFile = (file) ->
file.isUploading = true
Upload.upload(
url: '/api/file/'
data:
file: file
param1: 1
param2: 2
).then( (resp) ->
file.isComplete = true
console.log "успешно загружен #{file.name}"
, (resp) ->
file.isError = true
console.log "Ошибка при загрузке #{file.name}"
, (evt) ->
file.progress = parseInt(100.0 * evt.loaded / evt.total)
)
<button ngf-select
class="btn btn-info hidden-lg hidden-md"
accept="*/*"
ngf-pattern="*/*"
ngf-change="choiceFile()"
ng-model="file">
Choice to upload
</button>
Got AttributeError when attempting to get a value for field `files` on serializer `ProductSerializer`.
The serializer field might be named incorrectly and not match any attribute or key on the `Product` instance.
Original exception text was: 'Product' object has no attribute 'files'.
The field 'files' was declared on serializer ProductSerializer, but has not been included in the 'fields' option.
Давай последовательно.
1. сгенерил newrelic.ini:
newrelic-admin generate-config bbf3ab09ff newrelic.ini
import os
newrelic.agent.initialize('/home/username/path/to/myproject/newrelic.ini')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
application = newrelic.agent.wsgi_application()(application)
[uwsgi]
workers = 2
processes = 2
autoload = true
env = DJANGO_SETTINGS_MODULE=project.settings
module = project.wsgi
log-date = true
chdir = /home/www/%n/
virtualenv = /home/www/%n/.env/
pythonpath = /home/www/%n/
harakiri = 30
no-orphans = true
reload-mercy = 8
max-requests = 5000
eval = import newrelic.agent, wsgi; application = newrelic.agent.wsgi_application()(wsgi.application)
newrelic-admin validate-config newrelic.ini
, то все норм - запросы проходят в тестовый проект.