How solve an error occurred during the aws uploading with Angular? - amazon-web-services

How to reduce the following errors which are occurred while uploading the images to the s3 bucket with Angular 6. It has shown the following errors.
I had used the aws-SDK module for uploading the images or files to the s3 bucket of the aws.
I am using the angular6.2.0 version.
The errors that I got are:
PUT https://youtube-images-777.s3.amazonaws.com/ai2.png 400 (Bad Request)
zone.js:3243 PUT https://youtube-images-777.s3.amazonaws.com/ai2.png 403 (Forbidden)
scheduleTask # zone.js:3243
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:410
onScheduleTask # zone.js:301
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:404
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:261
scheduleMacroTaskWithCurrentZone # zone.js:1245
(anonymous) # zone.js:3276
proto.(anonymous function) # zone.js:1569
handleRequest # xhr.js:81
executeSend # event_listeners.js:334
SEND # event_listeners.js:348
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
(anonymous) # event_listeners.js:233
finish # config.js:350
(anonymous) # config.js:368
get # credentials.js:127
getAsyncCredentials # config.js:362
getCredentials # config.js:382
SIGN # event_listeners.js:204
callListeners # sequential_executor.js:102
callNextListener # sequential_executor.js:96
discoverEndpoint # discover_endpoint.js:326
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:423
onInvokeTask # core.js:14051
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:422
push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:195
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:498
ZoneTask.invoke # zone.js:487
timer # zone.js:2281
setTimeout (async)
scheduleTask # zone.js:2302
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:410
onScheduleTask # zone.js:301
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:404
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:261
scheduleMacroTaskWithCurrentZone # zone.js:1245
(anonymous) # zone.js:2317
proto.(anonymous function) # zone.js:1569
RESET_RETRY_STATE # event_listeners.js:470
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
reqRegionForNetworkingError # s3.js:638
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
requestBucketRegion # s3.js:609
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
onEnd # event_listeners.js:299
push../node_modules/aws-sdk/node_modules/events/events.js.EventEmitter.emit # events.js:78
finishRequest # xhr.js:124
(anonymous) # xhr.js:39
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:423
onInvokeTask # core.js:14051
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:422
push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:195
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:498
invokeTask # zone.js:1744
globalZoneAwareCallback # zone.js:1770
XMLHttpRequest.send (async)
scheduleTask # zone.js:3243
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:410
onScheduleTask # zone.js:301
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:404
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:261
scheduleMacroTaskWithCurrentZone # zone.js:1245
(anonymous) # zone.js:3276
proto.(anonymous function) # zone.js:1569
handleRequest # xhr.js:81
executeSend # event_listeners.js:334
SEND # event_listeners.js:348
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
(anonymous) # event_listeners.js:233
finish # config.js:350
(anonymous) # config.js:368
get # credentials.js:127
getAsyncCredentials # config.js:362
getCredentials # config.js:382
SIGN # event_listeners.js:204
callListeners # sequential_executor.js:102
callNextListener # sequential_executor.js:96
discoverEndpoint # discover_endpoint.js:326
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
(anonymous) # event_listeners.js:86
finish # config.js:350
(anonymous) # config.js:368
(anonymous) # credentials.js:124
(anonymous) # credentials.js:212
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:423
onInvokeTask # core.js:14051
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:422
push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:195
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:498
ZoneTask.invoke # zone.js:487
timer # zone.js:2281
setTimeout (async)
scheduleTask # zone.js:2302
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:410
onScheduleTask # zone.js:301
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:404
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:261
scheduleMacroTaskWithCurrentZone # zone.js:1245
(anonymous) # zone.js:2317
proto.(anonymous function) # zone.js:1569
defer # util.js:908
(anonymous) # credentials.js:211
arrayEach # util.js:493
onLoad # credentials.js:206
(anonymous) # cognito_identity_credentials.js:266
(anonymous) # request.js:364
callListeners # sequential_executor.js:106
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
onEnd # event_listeners.js:299
push../node_modules/aws-sdk/node_modules/events/events.js.EventEmitter.emit # events.js:78
finishRequest # xhr.js:124
(anonymous) # xhr.js:39
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:423
onInvokeTask # core.js:14051
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:422
push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:195
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:498
invokeTask # zone.js:1744
globalZoneAwareCallback # zone.js:1770
XMLHttpRequest.send (async)
scheduleTask # zone.js:3243
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:410
onScheduleTask # zone.js:301
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask # zone.js:404
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask # zone.js:238
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask # zone.js:261
scheduleMacroTaskWithCurrentZone # zone.js:1245
(anonymous) # zone.js:3276
proto.(anonymous function) # zone.js:1569
handleRequest # xhr.js:81
executeSend # event_listeners.js:334
SEND # event_listeners.js:348
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
discoverEndpoint # discover_endpoint.js:328
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
callNextListener # sequential_executor.js:96
(anonymous) # event_listeners.js:149
(anonymous) # util.js:725
hash # util.js:457
sha256 # util.js:408
computeSha256 # util.js:723
COMPUTE_SHA256 # event_listeners.js:143
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
(anonymous) # state_machine.js:26
(anonymous) # request.js:38
(anonymous) # request.js:685
callListeners # sequential_executor.js:116
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
runTo # request.js:403
send # request.js:367
makeUnauthenticatedRequest # service.js:230
getCredentialsForIdentity # cognitoidentity.js:13
getCredentialsForIdentity # cognito_identity_credentials.js:258
(anonymous) # cognito_identity_credentials.js:175
getId # cognito_identity_credentials.js:227
load # cognito_identity_credentials.js:172
coalesceRefresh # credentials.js:205
refresh # cognito_identity_credentials.js:160
get # credentials.js:122
getAsyncCredentials # config.js:362
getCredentials # config.js:382
VALIDATE_CREDENTIALS # event_listeners.js:81
callListeners # sequential_executor.js:102
emit # sequential_executor.js:78
emit # request.js:683
transition # request.js:22
runTo # state_machine.js:14
runTo # request.js:403
send # request.js:367
nextChunk # managed_upload.js:473
fillBuffer # managed_upload.js:403
send # managed_upload.js:199
upload # s3.js:1080
push../src/app/aws/aws.component.ts.AwsComponent.fileEvent # aws.component.ts:36
(anonymous) # AwsComponent.html:3
handleEvent # core.js:19545
callWithDebugContext # core.js:20639
debugHandleEvent # core.js:20342
dispatchEvent # core.js:16994
(anonymous) # core.js:17441
(anonymous) # platform-browser.js:993
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:423
onInvokeTask # core.js:14051
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask # zone.js:422
push../node_modules/zone.js/dist/zone.js.Zone.runTask # zone.js:195
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask # zone.js:498
invokeTask # zone.js:1744
globalZoneAwareCallback # zone.js:1770
aws.component.ts:40 AccessDenied: Access Denied
at Request.extractError (http://localhost:4200/vendor.js:80023:35)
at Request.callListeners (http://localhost:4200/vendor.js:77941:20)
at Request.emit (http://localhost:4200/vendor.js:77913:10)
at Request.emit (http://localhost:4200/vendor.js:76546:14)
at Request.transition (http://localhost:4200/vendor.js:75885:10)
at AcceptorStateMachine.runTo (http://localhost:4200/vendor.js:81632:12)
at http://localhost:4200/vendor.js:81644:10
at Request.<anonymous> (http://localhost:4200/vendor.js:75901:9)
at Request.<anonymous> (http://localhost:4200/vendor.js:76548:12)
at Request.callListeners (http://localhost:4200/vendor.js:77951:18) "there was an error uploading your file"
import { Component, OnInit } from "#angular/core";
import * as AWS from "aws-sdk";
#Component({
selector: "app-aws",
templateUrl: "./aws.component.html",
styleUrls: ["./aws.component.css"]
})
export class AwsComponent implements OnInit {
constructor() {}
ngOnInit() {}
fileEvent(fileInput: any) {
const AWSService = AWS;
console.log(AWSService);
const region = "***********";
const bucketName = "***************";
const IdentityPoolId = "**********************";
const file = fileInput.target.files[0];
//Configures the AWS service and initial authorization
AWSService.config.update({
region: region,
credentials: new AWSService.CognitoIdentityCredentials({
IdentityPoolId: IdentityPoolId
})
});
//adds the S3 service, make sure the api version and bucket are correct
const s3 = new AWSService.S3({
apiVersion: "2006-03-01",
params: { Bucket: bucketName }
});
//I store this in a variable for retrieval later
const image = file.name;
console.log(image);
s3.upload(
{ Key: file.name, Bucket: bucketName, Body: file, ACL: "public-read" },
function(err, data) {
if (err) {
console.log(err, "there was an error uploading your file");
}
}
);
}
}

The error clearly states this is a permission issue. Check your policy for cognito auth user and grant get and put object rights to the correct s3 bucket.

Related

OpenCart 3 error using PayPal

I have setup OpenCart 3 here www.toolfolks.com/shop
When I add this product for a test http://toolfolks.com/shop/index.php?rou ... 7&search=£ (it is only 10 pence ) I can purchase from a mobile device but a web browser fails.
I see the following in the console:
logger.js:53 ppxo_paypal_legacy_component_error Object {error: "Error: Unexpected init message from domain https:/…ects.com/api/checkout.js?_=1500727174949:2414:13)", timestamp: 1500727199320, windowID: "8145ed1bca", pageID: "70cfa4e30c", referer: "toolfolks.com"…}
Error: Unexpected init message from domain https://www.paypal.com -- expected message from https://www.sandbox.paypal.com
at Object.handler (https://www.paypalobjects.com/api/check ... 49:3563:41)
at https://www.paypalobjects.com/api/check ... 49:2464:32
at Function.ZalgoPromise.try (https://www.paypalobjects.com/api/check ... 49:7735:37)
at Object._RECEIVE_MESSAGE_TYPE.(anonymous function) [as postrobot_message_request] (https://www.paypalobjects.com/api/check ... 49:2460:70)
at receiveMessage (https://www.paypalobjects.com/api/check ... 49:2393:77)
at messageListener (https://www.paypalobjects.com/api/check ... 49:2414:13)
print # logger.js:53
log # logger.js:161
error # logger.js:188
(anonymous) # interface.js:240
(anonymous) # util.js:50
(anonymous) # promise.js:158
ZalgoPromise.dispatch # promise.js:183
ZalgoPromise.reject # promise.js:111
(anonymous) # promise.js:153
ZalgoPromise.dispatch # promise.js:183
ZalgoPromise.reject # promise.js:111
(anonymous) # promise.js:179
(anonymous) # promise.js:158
ZalgoPromise.dispatch # promise.js:183
ZalgoPromise.reject # promise.js:111
(anonymous) # index.js:1176
ZalgoPromise.try # promise.js:291
ParentComponent.error # index.js:1175
ZalgoPromise.try # promise.js:291
error:promisified # decorators.js:25
(anonymous) # base.js:184
(anonymous) # types.js:65
ZalgoPromise.try # promise.js:291
_RECEIVE_MESSAGE_TYPE.(anonymous function) # types.js:53
receiveMessage # index.js:112
messageListener # index.js:138
logger.js:53 ppxo_paypal_legacy_render_error_hijack_revert_target Object {timestamp: 1500727199339, windowID: "8145ed1bca", pageID: "70cfa4e30c", referer: "toolfolks.com", host: "toolfolks.com"…}
print # logger.js:53
log # logger.js:161
warn # logger.js:184
(anonymous) # interface.js:243
(anonymous) # util.js:50
(anonymous) # promise.js:158
ZalgoPromise.dispatch # promise.js:183
ZalgoPromise.reject # promise.js:111
(anonymous) # promise.js:153
ZalgoPromise.dispatch # promise.js:183
ZalgoPromise.reject # promise.js:111
(anonymous) # promise.js:179
(anonymous) # promise.js:158
ZalgoPromise.dispatch # promise.js:183
ZalgoPromise.reject # promise.js:111
(anonymous) # index.js:1176
ZalgoPromise.try # promise.js:291
ParentComponent.error # index.js:1175
ZalgoPromise.try # promise.js:291
error:promisified # decorators.js:25
(anonymous) # base.js:184
(anonymous) # types.js:65
ZalgoPromise.try # promise.js:291
_RECEIVE_MESSAGE_TYPE.(anonymous function) # types.js:53
receiveMessage # index.js:112
messageListener # index.js:138
I have enabled Debug logging but don't know where any log files go ?
Any help appreciated.

Trying to create database in mezzanine django, and getting strange error

I've created a virtual environment for a mezzanine project containing the following dependencie
Django==1.7.1
Fabric==1.10.1
Mezzanine==3.1.10
argparse==1.2.1
bleach==1.4.1
django-filebrowser==3.5.7
django-grappelli==2.6.3
future==0.14.3
grappelli-safe==0.3.13
html5lib==0.999
importlib==1.0.3
mezzanine-grappelli==0.1.0
pytz==2014.10
six==1.8.0
unittest2==0.8.0
wsgiref==0.1.2
When I try to run the 'python manage.py createdb' command I get the following error:
Traceback (most recent call last):
File "/home/joe/JoeDevelopsSite/JoeDevelopsSite/manage.py", line 28, in <module>
execute_from_command_line(sys.argv)
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/mezzanine/forms/models.py", line 10, in <module>
from mezzanine.forms import fields
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/mezzanine/forms/fields.py", line 9, in <module>
from mezzanine.core.forms import SplitSelectDateTimeWidget
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/mezzanine/core/forms.py", line 40, in <module>
if settings.GRAPPELLI_INSTALLED:
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/mezzanine/conf/__init__.py", line 184, in __getattr__
return getattr(django_settings, name)
File "/home/joe/JoeDevelopsSite/local/lib/python2.7/site-packages/django/conf/__init__.py", line 46, in __getattr__
return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'GRAPPELLI_INSTALLED'
Here's the full settings.py file:
from __future__ import absolute_import, unicode_literals
######################
# MEZZANINE SETTINGS #
######################
# The following settings are already defined with default values in
# the ``defaults.py`` module within each of Mezzanine's apps, but are
# common enough to be put here, commented out, for convenient
# overriding. Please consult the settings documentation for a full list
# of settings Mezzanine implements:
# http://mezzanine.jupo.org/docs/configuration.html#default-settings
# Controls the ordering and grouping of the admin menu.
#
# ADMIN_MENU_ORDER = (
# ("Content", ("pages.Page", "blog.BlogPost",
# "generic.ThreadedComment", ("Media Library", "fb_browse"),)),
# ("Site", ("sites.Site", "redirects.Redirect", "conf.Setting")),
# ("Users", ("auth.User", "auth.Group",)),
# )
# A three item sequence, each containing a sequence of template tags
# used to render the admin dashboard.
#
# DASHBOARD_TAGS = (
# ("blog_tags.quick_blog", "mezzanine_tags.app_list"),
# ("comment_tags.recent_comments",),
# ("mezzanine_tags.recent_actions",),
# )
#
# A sequence of templates used by the ``page_menu`` template tag. Each
# item in the sequence is a three item sequence, containing a unique ID
# for the template, a label for the template, and the template path.
# These templates are then available for selection when editing which
# menus a page should appear in. Note that if a menu template is used
# that doesn't appear in this setting, all pages will appear in it.
# PAGE_MENU_TEMPLATES = (
# (1, "Top navigation bar", "pages/menus/dropdown.html"),
# (2, "Left-hand tree", "pages/menus/tree.html"),
# (3, "Footer", "pages/menus/footer.html"),
# )
# A sequence of fields that will be injected into Mezzanine's (or any
# library's) models. Each item in the sequence is a four item sequence.
# The first two items are the dotted path to the model and its field
# name to be added, and the dotted path to the field class to use for
# the field. The third and fourth items are a sequence of positional
# args and a dictionary of keyword args, to use when creating the
# field instance. When specifying the field class, the path
# ``django.models.db.`` can be omitted for regular Django model fields.
#
# EXTRA_MODEL_FIELDS = (
# (
# # Dotted path to field.
# "mezzanine.blog.models.BlogPost.image",
# # Dotted path to field class.
# "somelib.fields.ImageField",
# # Positional args for field class.
# ("Image",),
# # Keyword args for field class.
# {"blank": True, "upload_to": "blog"},
# ),
# # Example of adding a field to *all* of Mezzanine's content types:
# (
# "mezzanine.pages.models.Page.another_field",
# "IntegerField", # 'django.db.models.' is implied if path is omitted.
# ("Another name",),
# {"blank": True, "default": 1},
# ),
# )
# Setting to turn on featured images for blog posts. Defaults to False.
#
# BLOG_USE_FEATURED_IMAGE = True
# If True, the south application will be automatically added to the
# INSTALLED_APPS setting.
USE_SOUTH = True
######################### MAIN DJANGO SETTINGS #
########################
# People who get code error notifications.
# In the format (('Full Name', 'email#example.com'),
# ('Full Name', 'anotheremail#example.com'))
ADMINS = (
# ('Your Name', 'your_email#domain.com'),
)
MANAGERS = ADMINS
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = None
# If you set this to True, Django will use timezone-aware datetimes.
USE_TZ = True
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = "en"
# Supported languages
_ = lambda s: s
LANGUAGES = (
('en', _('English')),
)
# A boolean that turns on/off debug mode. When set to ``True``, stack traces
# are displayed for error pages. Should always be set to ``False`` in
# production. Best set to ``True`` in local_settings.py
DEBUG = False
# Whether a user's session cookie expires when the Web browser is closed.
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = False
# Tuple of IP addresses, as strings, that:
# * See debug comments, when DEBUG is true
# * Receive x-headers
INTERNAL_IPS = ("127.0.0.1",)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
)
AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend",)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# The numeric mode to set newly-uploaded files to. The value should be
# a mode you'd pass directly to os.chmod.
FILE_UPLOAD_PERMISSIONS = 0o644
#############
# DATABASES#############
DATABASES = {
"default": {
# Add "postgresql_psycopg2", "mysql", "sqlite3" or "oracle".
"ENGINE": "django.db.backends.",
# DB name or path to database file if using sqlite3.
"NAME": "",
# Not used with sqlite3.
"USER": "",
# Not used with sqlite3.
"PASSWORD": "",
# Set to empty string for localhost. Not used with sqlite3.
"HOST": "",
# Set to empty string for default. Not used with sqlite3.
"PORT": "",
}
}
#########
# PATHS #
#########
#import os
# Full filesystem path to the project.
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
# Name of the directory for the project.
PROJECT_DIRNAME = PROJECT_ROOT.split(os.sep)[-1]
# Every cache key will get prefixed with this value - here we set it to
# the name of the directory the project is in to try and use something
# project specific.
CACHE_MIDDLEWARE_KEY_PREFIX = PROJECT_DIRNAME
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = "/static/"
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL.strip("/"))
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = STATIC_URL + "media/"
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, *MEDIA_URL.strip("/").split("/"))
# Package/module name to import the root urlpatterns from for the project.
ROOT_URLCONF = "%s.urls" % PROJECT_DIRNAME
# Put strings here, like "/home/html/django_templates"
# or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, "templates"),)
################
# APPLICATIONS #
################
INSTALLED_APPS = (
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.redirects",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.sitemaps",
"django.contrib.staticfiles",
"mezzanine.boot",
"mezzanine.conf",
"mezzanine.core",
"mezzanine.generic",
"mezzanine.blog",
"mezzanine.forms",
"mezzanine.pages",
"mezzanine.galleries",
"mezzanine.twitter",
#"mezzanine.accounts",
#"mezzanine.mobile",
)
# List of processors used by RequestContext to populate the context.
# Each one should be a callable that takes the request object as its
# only parameter and returns a dictionary to add to the context.
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.static",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.core.context_processors.tz",
"mezzanine.conf.context_processors.settings",
"mezzanine.pages.context_processors.page",
)
# List of middleware classes to use. Order is important; in the request phase,
# these middleware classes will be applied in the order given, and in the
# response phase the middleware will be applied in reverse order.
MIDDLEWARE_CLASSES = (
"mezzanine.core.middleware.UpdateCacheMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"mezzanine.core.request.CurrentRequestMiddleware",
"mezzanine.core.middleware.RedirectFallbackMiddleware",
"mezzanine.core.middleware.TemplateForDeviceMiddleware",
"mezzanine.core.middleware.TemplateForHostMiddleware",
"mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware",
"mezzanine.core.middleware.SitePermissionMiddleware",
# Uncomment the following if using any of the SSL settings:
# "mezzanine.core.middleware.SSLRedirectMiddleware",
"mezzanine.pages.middleware.PageMiddleware",
"mezzanine.core.middleware.FetchFromCacheMiddleware",
)
# Store these package names here as they may change in the future since
# at the moment we are using custom forks of them.
PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
PACKAGE_NAME_GRAPPELLI = "grappelli_safe"
#########################
# OPTIONAL APPLICATIONS #
#########################
# These will be added to ``INSTALLED_APPS``, only if available.
OPTIONAL_APPS = (
"debug_toolbar",
"django_extensions",
"compressor",
PACKAGE_NAME_FILEBROWSER,
PACKAGE_NAME_GRAPPELLI,
)
###################
# DEPLOY SETTINGS #
###################
# These settings are used by the default fabfile.py provided.
# Check fabfile.py for defaults.
#FABRIC = {
# "SSH_USER": "", # SSH username for host deploying to
# "HOSTS": ALLOWED_HOSTS[:1], # List of hosts to deploy to (eg, first host)
# "DOMAINS": ALLOWED_HOSTS, # Domains for public site
# "REPO_URL": "ssh://hg#bitbucket.org/user/project", # Project's repo URL
# "VIRTUALENV_HOME": "", # Absolute remote path for virtualenvs
# "PROJECT_NAME": "", # Unique identifier for project
# "REQUIREMENTS_PATH": "requirements.txt", # Project's pip requirements
# "GUNICORN_PORT": 8000, # Port gunicorn will listen on
# "LOCALE": "en_US.UTF-8", # Should end with ".UTF-8"
# "DB_PASS": "", # Live database password
# "ADMIN_PASS": "", # Live admin user password
# "SECRET_KEY": SECRET_KEY,
# "NEVERCACHE_KEY": NEVERCACHE_KEY,
# }
##################
# LOCAL SETTINGS #
##################
# Allow any settings to be defined in local_settings.py which should be
# ignored in your version control system allowing for settings to be
# defined per machine.
try:
from local_settings import *
except ImportError as e:
if "local_settings" not in str(e):
raise e
####################
# DYNAMIC SETTINGS #
####################
# set_dynamic_settings() will rewrite globals based on what has been
# defined so far, in order to provide some better defaults where
# applicable. We also allow this settings module to be imported
# without Mezzanine installed, as the case may be when using the
# fabfile, where setting the dynamic settings below isn't strictly
# required.
try:
from mezzanine.utils.conf import set_dynamic_settings
except ImportError:
pass
else:
set_dynamic_settings(globals())
I've been unable to find a solution to this error. Would love guidance.
Thanks!
Mezzanine works with Django 1.6. An incorrect version of Django was being used.

Logging shows wrong linenumber

Im trying to learn python 2.7s logging module, and have copied this clip:
def _logging():
# set up program logging
global logger
# valid logging levels:
# =====================
# logger.debug('debug message')
# logger.info('info message')
# logger.warn('warn message')
# logger.error('error message')
# logger.critical('critical message')
#
# to show traceback:
# logger.critical(str(e), exc_info = True) # if 'error' & 'True' - halts script
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
# create file handler which logs INFO & above messages
fh = logging.FileHandler('c:/temp/pgmLog.log','w')
fh.setLevel(logging.INFO)
# create console handler that logs all messages
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
# create formatter and add it to the handlers
formatter = logging.Formatter('%(asctime)s %(lineno)-5d %(levelname)-12s %(message)s', datefmt='%m-%d-%Y %H:%M:%S')
ch.setFormatter(formatter)
fh.setFormatter(formatter)
# add the handlers to logger
logger.addHandler(ch) # console logger
logger.addHandler(fh) # file logger
when I run the following piece:
logger.info('Program start')
try:
print 3/0
except Exception, err:
logger.error(err)
the logger is showing me:
11-22-2014 15:48:32 46 INFO Program start
11-22-2014 15:48:32 1415 ERROR integer division or modulo by zero
Can someone please tell me why the error is showing as line 1415, and not the real location of the error?
Many thanks

Unknown command: 'collectstatic' while deploying a Mezzanine app on Heroku

I am trying to deploy a Mezzanine app I have built, but I am running into many issues with the settings.py file. I have tried what has been suggested in quite a few tutorials for getting Mezzanine apps on Heroku, and none of them have worked, plus I am now confused as to what changes I have made. When I run things locally there are no issues.
Currently I have my urls set as in this post: https://gist.github.com/joshfinnie/4046138
and this is my settings.py
from __future__ import absolute_import, unicode_literals
import os
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(PROJECT_PATH, 'static'),
)
######################
# MEZZANINE SETTINGS #
######################
# The following settings are already defined with default values in
# the ``defaults.py`` module within each of Mezzanine's apps, but are
# common enough to be put here, commented out, for convenient
# overriding. Please consult the settings documentation for a full list
# of settings Mezzanine implements:
# http://mezzanine.jupo.org/docs/configuration.html#default-settings
# Controls the ordering and grouping of the admin menu.
#
# ADMIN_MENU_ORDER = (
# ("Content", ("pages.Page", "blog.BlogPost",
# "generic.ThreadedComment", ("Media Library", "fb_browse"),)),
# ("Site", ("sites.Site", "redirects.Redirect", "conf.Setting")),
# ("Users", ("auth.User", "auth.Group",)),
# )
# A three item sequence, each containing a sequence of template tags
# used to render the admin dashboard.
#
# DASHBOARD_TAGS = (
# ("blog_tags.quick_blog", "mezzanine_tags.app_list"),
# ("comment_tags.recent_comments",),
# ("mezzanine_tags.recent_actions",),
# )
# A sequence of templates used by the ``page_menu`` template tag. Each
# item in the sequence is a three item sequence, containing a unique ID
# for the template, a label for the template, and the template path.
# These templates are then available for selection when editing which
# menus a page should appear in. Note that if a menu template is used
# that doesn't appear in this setting, all pages will appear in it.
# PAGE_MENU_TEMPLATES = (
# (1, "Top navigation bar", "pages/menus/dropdown.html"),
# (2, "Left-hand tree", "pages/menus/tree.html"),
# (3, "Footer", "pages/menus/footer.html"),
# )
# A sequence of fields that will be injected into Mezzanine's (or any
# library's) models. Each item in the sequence is a four item sequence.
# The first two items are the dotted path to the model and its field
# name to be added, and the dotted path to the field class to use for
# the field. The third and fourth items are a sequence of positional
# args and a dictionary of keyword args, to use when creating the
# field instance. When specifying the field class, the path
# ``django.models.db.`` can be omitted for regular Django model fields.
#
# EXTRA_MODEL_FIELDS = (
# (
# # Dotted path to field.
# "mezzanine.blog.models.BlogPost.image",
# # Dotted path to field class.
# "somelib.fields.ImageField",
# # Positional args for field class.
# ("Image",),
# # Keyword args for field class.
# {"blank": True, "upload_to": "blog"},
# ),
# # Example of adding a field to *all* of Mezzanine's content types:
# (
# "mezzanine.pages.models.Page.another_field",
# "IntegerField", # 'django.db.models.' is implied if path is omitted.
# ("Another name",),
# {"blank": True, "default": 1},
# ),
# )
# Setting to turn on featured images for blog posts. Defaults to False.
#
# BLOG_USE_FEATURED_IMAGE = True
# If True, the south application will be automatically added to the
# INSTALLED_APPS setting.
USE_SOUTH = True
#BLOG_SLUG = ""
########################
# MAIN DJANGO SETTINGS #
########################
# People who get code error notifications.
# In the format (('Full Name', 'email#example.com'),
# ('Full Name', 'anotheremail#example.com'))
ADMINS = (
# ('Your Name', 'your_email#domain.com'),
('Jessie Alvarez', 'jessiea#stanford.edu'),
)
MANAGERS = ADMINS
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Los_Angeles'
# If you set this to True, Django will use timezone-aware datetimes.
USE_TZ = True
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = "en"
# Supported languages
_ = lambda s: s
LANGUAGES = (
('en', _('English')),
)
# A boolean that turns on/off debug mode. When set to ``True``, stack traces
# are displayed for error pages. Should always be set to ``False`` in
# production. Best set to ``True`` in local_settings.py
DEBUG = False
# Whether a user's session cookie expires when the Web browser is closed.
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = False
# Tuple of IP addresses, as strings, that:
# * See debug comments, when DEBUG is true
# * Receive x-headers
INTERNAL_IPS = ("127.0.0.1",)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
)
AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend",)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# The numeric mode to set newly-uploaded files to. The value should be
# a mode you'd pass directly to os.chmod.
FILE_UPLOAD_PERMISSIONS = 0o644
#############
# DATABASES #
#############
import dj_database_url
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
#########
# PATHS #
#########
#import os
# Full filesystem path to the project.
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
# Name of the directory for the project.
PROJECT_DIRNAME = PROJECT_ROOT.split(os.sep)[-1]
# Every cache key will get prefixed with this value - here we set it to
# the name of the directory the project is in to try and use something
# project specific.
CACHE_MIDDLEWARE_KEY_PREFIX = PROJECT_DIRNAME
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = "/static/"
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
# STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL.strip("/"))
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = STATIC_URL + "media/"
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, *MEDIA_URL.strip("/").split("/"))
# Package/module name to import the root urlpatterns from for the project.
ROOT_URLCONF = "%s.urls" % PROJECT_DIRNAME
# Put strings here, like "/home/html/django_templates"
# or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, "templates"),)
################
# APPLICATIONS #
################
INSTALLED_APPS = (
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.redirects",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.sitemaps",
"django.contrib.staticfiles",
"mezzanine.boot",
"mezzanine.conf",
"mezzanine.core",
"mezzanine.generic",
"mezzanine.blog",
"mezzanine.forms",
"mezzanine.pages",
"mezzanine.galleries",
"mezzanine.twitter",
"gunicorn",
#"mezzanine.accounts",
#"mezzanine.mobile",
)
# List of processors used by RequestContext to populate the context.
# Each one should be a callable that takes the request object as its
# only parameter and returns a dictionary to add to the context.
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.static",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.core.context_processors.tz",
"mezzanine.conf.context_processors.settings",
"mezzanine.pages.context_processors.page",
)
# List of middleware classes to use. Order is important; in the request phase,
# these middleware classes will be applied in the order given, and in the
# response phase the middleware will be applied in reverse order.
MIDDLEWARE_CLASSES = (
"mezzanine.core.middleware.UpdateCacheMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"mezzanine.core.request.CurrentRequestMiddleware",
"mezzanine.core.middleware.RedirectFallbackMiddleware",
"mezzanine.core.middleware.TemplateForDeviceMiddleware",
"mezzanine.core.middleware.TemplateForHostMiddleware",
"mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware",
"mezzanine.core.middleware.SitePermissionMiddleware",
# Uncomment the following if using any of the SSL settings:
# "mezzanine.core.middleware.SSLRedirectMiddleware",
"mezzanine.pages.middleware.PageMiddleware",
"mezzanine.core.middleware.FetchFromCacheMiddleware",
)
# Store these package names here as they may change in the future since
# at the moment we are using custom forks of them.
PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
PACKAGE_NAME_GRAPPELLI = "grappelli_safe"
#########################
# OPTIONAL APPLICATIONS #
#########################
# These will be added to ``INSTALLED_APPS``, only if available.
OPTIONAL_APPS = (
"debug_toolbar",
"django_extensions",
"compressor",
PACKAGE_NAME_FILEBROWSER,
PACKAGE_NAME_GRAPPELLI,
)
###################
# DEPLOY SETTINGS #
###################
# These settings are used by the default fabfile.py provided.
# Check fabfile.py for defaults.
# FABRIC = {
# "SSH_USER": "", # SSH username for host deploying to
# "HOSTS": ALLOWED_HOSTS[:1], # List of hosts to deploy to (eg, first host)
# "DOMAINS": ALLOWED_HOSTS, # Domains for public site
# "REPO_URL": "ssh://hg#bitbucket.org/user/project", # Project's repo URL
# "VIRTUALENV_HOME": "", # Absolute remote path for virtualenvs
# "PROJECT_NAME": "", # Unique identifier for project
# "REQUIREMENTS_PATH": "requirements.txt", # Project's pip requirements
# "GUNICORN_PORT": 8000, # Port gunicorn will listen on
# "LOCALE": "en_US.UTF-8", # Should end with ".UTF-8"
# "DB_PASS": "", # Live database password
# "ADMIN_PASS": "", # Live admin user password
# "SECRET_KEY": SECRET_KEY,
# "NEVERCACHE_KEY": NEVERCACHE_KEY,
# }
##################
# LOCAL SETTINGS #
##################
# Allow any settings to be defined in local_settings.py which should be
# ignored in your version control system allowing for settings to be
# defined per machine.
try:
from local_settings import *
except ImportError:
pass
####################
# DYNAMIC SETTINGS #
####################
# set_dynamic_settings() will rewrite globals based on what has been
# defined so far, in order to provide some better defaults where
# applicable. We also allow this settings module to be imported
# without Mezzanine installed, as the case may be when using the
# fabfile, where setting the dynamic settings below isn't strictly
# required.
try:
from mezzanine.utils.conf import set_dynamic_settings
except ImportError:
pass
else:
set_dynamic_settings(globals())
Run heroku run python manage.py help – at least for me that helped to get a more accurate description of the error. For me, the problem wasn't that collectstatic was missing, but that an environment variable wasn't set. That cause created the sympton of collectstatic to appear missing.

"'str' object is not callable" in urls.py in Django Project

I'm getting the TypeError 'str' object is not callable in my Django Project when i access the url "localhost:8000/adminPonto" of the project (i'm brazillian). It follows below the codes of urls.py (within the error lies) and adminApp.views (code related to urls.py and, consequently, to the error):
urls.py
# -- coding:iso-8859-1 --
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
import baterPonto.views
import adminApp.views
import PontoCOSGEM.views
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Sistema de Ponto
(r'^ponto/$',baterPonto.views.index), # Pagina inicial da administracao do registro de ponto
(r'^ponto/registrar/$',baterPonto.views.registrar_ponto),
# Administracao do Ponto
(r'^adminPonto/$',adminApp.views.loginIndex), # Formulario de login da admin. de ponto
(r'^adminPonto/login/$',adminApp.views.entrar), # Pagina de login da admin. de ponto
(r'^adminPonto/logout/$',adminApp.views.sair), # Pagina de logout da admin. de ponto
(r'^adminPonto/index/$',adminApp.views.index), # Pagina inicial do sistema de adm.
# Gerencia de Funcionarios
(r'^adminPonto/funcionarios/$',adminApp.views.funcionariosIndex), # Menu de gerência dos funcionarios
'''(r'^adminPonto/funcionarios/search/$',adminApp.views.funcionariosSearch), # Procura por funcionario
(r'^adminPonto/funcionarios/add/$',adminApp.views.funcionariosAdd), # Adiciona funcionarios
(r'^adminPonto/funcionarios/edit/$',adminApp.views.funcionariosEdit), # Edita funcionarios
(r'^adminPonto/funcionarios/delete/$',adminApp.views.funcionariosDelete), # Apaga funcionarios
(r'^adminPonto/funcionarios/list/$',adminApp.views.funcionariosList), # Lista todos os funcionarios'''
# Relatorio de Ponto
(r'^adminPonto/relatorios/$',adminApp.views.relatorioIndex), # Menu de relatorio de ponto (por funcionario ou de todos)
# Examples:
# url(r'^$', 'PontoCOSGEM.views.home', name='home'),
# url(r'^PontoCOSGEM/', include('PontoCOSGEM.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
)
views.py
# -- coding: iso-8859-1 --
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth import authenticate, login, logout
def userLoged(request,url):
insertMessage = False
testUser = ""
try:
testUser = request.session['user']
except KeyError:
insertMessage = True
message = "É preciso estar logado para acessar esta página."
return render_to_response('loginAdmin.html',locals(),context_instance=RequestContext(request));
if testUser is not None:
return render_to_response(url,locals(),context_instance=RequestContext(request));
else:
insertMessage = True
message = "É preciso estar logado para acessar esta página."
return render_to_response('loginAdmin.html',locals(),context_instance=RequestContext(request));
def loginIndex(request):
return render_to_response('loginAdmin.html',locals(),context_instance=RequestContext(request))
def entrar(request):
insertMessage = False
message = "Erro. Usuário ou Senha incorretos."
lg = "Usuario"
passwd = "Senha"
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
request.session['user'] = user
return render_to_response('indexAdmin.html',locals(),context_instance=RequestContext(request));
else:
insertMessage = True
return render_to_response('loginAdmin.html',locals(),context_instance=RequestContext(request));
def sair(request):
insertMessage = True
message = "Saída realizada com sucesso."
logout(request)
return render_to_response('loginAdmin.html',locals(),context_instance=RequestContext(request));
def index(request):
userLoged(request,'indexAdmin.html')
# Gerência de funcionarios
def funcionariosIndex(request):
userLoged(request,'funcionarioIndex.html')
'''def funcionariosSearch(request):
def funcionariosAdd(request):
def funcionariosEdit(request):
def funcionariosDelete(request):
def funcionariosList(request):'''
# Gerência de relatórios
def relatorioIndex(request):
return HttpResponse("Menu de escolha de relatorios")
# Create your views here.
Honestly, I can't get see errors in code above, and i don't know why this error is occurring.
Does anyone, so, knows why the 'str' object is not callable is appearing?
Multiline comments like '''comment text''' can cause troubles.
Try commenting five lines from
'''(r'^adminPonto/funcionarios/search/$',adminApp.views.funcionariosSearch), # Procura por funcionario
with '#' and tell if it helps.