i am new to django. I am deploying my simple web application on heroku server via github. But when i deploy it, my build going to fail and it show this error on heroku logs:
-----> Python app detected
-----> Installing python-3.8.3
-----> Installing pip
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting appdirs==1.4.4
Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting asgiref==3.2.10
Downloading asgiref-3.2.10-py3-none-any.whl (19 kB)
Collecting distlib==0.3.1
Downloading distlib-0.3.1-py2.py3-none-any.whl (335 kB)
Collecting Django==3.0.8
Downloading Django-3.0.8-py3-none-any.whl (7.5 MB)
Collecting django-filter==2.3.0
Downloading django_filter-2.3.0-py3-none-any.whl (73 kB)
Collecting filelock==3.0.12
Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting gunicorn==20.0.4
Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
Collecting Pillow==7.2.0
Downloading Pillow-7.2.0-cp38-cp38-manylinux1_x86_64.whl (2.2 MB)
Collecting pytz==2020.1
Downloading pytz-2020.1-py2.py3-none-any.whl (510 kB)
Collecting six==1.15.0
Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting sqlparse==0.3.1
Downloading sqlparse-0.3.1-py2.py3-none-any.whl (40 kB)
Collecting virtualenv==20.0.26
Downloading virtualenv-20.0.26-py2.py3-none-any.whl (4.9 MB)
Collecting virtualenvwrapper-win==1.2.6
Downloading virtualenvwrapper-win-1.2.6.tar.gz (21 kB)
Collecting whitenoise==5.1.0
Downloading whitenoise-5.1.0-py2.py3-none-any.whl (19 kB)
Building wheels for collected packages: virtualenvwrapper-win
Building wheel for virtualenvwrapper-win (setup.py): started
Building wheel for virtualenvwrapper-win (setup.py): finished with status 'done'
Created wheel for virtualenvwrapper-win: filename=virtualenvwrapper_win-1.2.6-py3-none-any.whl size=18609 sha256=2894b9f0d8294f17c34d3498acb2ec9baba93dd1039a36a8e44c1252d8d2bb41
Stored in directory: /tmp/pip-ephem-wheel-cache-lqj2a4ec/wheels/66/25/f7/f4b3539b1cc86289c4e24e637c09a39f8f2ab6de61928f0be1
Successfully built virtualenvwrapper-win
Installing collected packages: appdirs, asgiref, distlib, pytz, sqlparse, Django, django-filter, filelock, gunicorn, Pillow, six, virtualenv, virtualenvwrapper-win, whitenoise
Successfully installed Django-3.0.8 Pillow-7.2.0 appdirs-1.4.4 asgiref-3.2.10 distlib-0.3.1 django-filter-2.3.0 filelock-3.0.12 gunicorn-20.0.4 pytz-2020.1 six-1.15.0 sqlparse-0.3.1 virtualenv-20.0.26 virtualenvwrapper-win-1.2.6 whitenoise-5.1.0
-----> $ python CommonModules/manage.py collectstatic --noinput
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 25, in <module>
import psycopg2 as Database
ModuleNotFoundError: No module named 'psycopg2'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "CommonModules/manage.py", line 21, in <module>
main()
File "CommonModules/manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute
django.setup()
File "/app/.heroku/python/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/app/.heroku/python/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/app/.heroku/python/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/app/.heroku/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/models/base.py", line 121, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/models/base.py", line 325, in add_to_class
value.contribute_to_class(cls, name)
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/models/options.py", line 208, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/utils.py", line 207, in __getitem__
backend = load_backend(db['ENGINE'])
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/utils.py", line 111, in load_backend
return import_module('%s.base' % backend_name)
File "/app/.heroku/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 29, in <module>
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'
! Error while running '$ python CommonModules/manage.py collectstatic --noinput'.
See traceback above for details.
You may need to update application code to resolve this error.
Or, you can disable collectstatic for this application:
$ heroku config:set DISABLE_COLLECTSTATIC=1
https://devcenter.heroku.com/articles/django-assets
! Push rejected, failed to compile Python app.
! Push failed
My settings.py file in django project is:
"""
Django settings for common project.
Generated by 'django-admin startproject' using Django 3.0.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '***************************************************'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['common-module.herokuapp.com','127.0.0.1']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'user'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'common.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'common.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'common',
'USER':'postgres',
'PASSWORD':'****',
'HOST':'localhost'
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
# STATIC_ROOT = os.path.normpath(os.path.join(BASE_DIR, 'staticfiles'))
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
My requirements.txt file:
appdirs==1.4.4
asgiref==3.2.10
distlib==0.3.1
Django==3.0.8
django-filter==2.3.0
filelock==3.0.12
gunicorn==20.0.4
Pillow==7.2.0
psycopg2==2.8.5
psycopg2-binary==2.8.5
pytz==2020.1
six==1.15.0
sqlparse==0.3.1
virtualenv==20.0.26
virtualenvwrapper-win==1.2.6
whitenoise==5.1.0
Can anyone told me where i am doing wrong. And the solution to successfully deploy this app on heroku.
Related
I am trying to deploy my own django app on google cloud.
I'm following this documentation
by Google Cloud to deploy the app.
I have changed the settings.py file of my app according to the settings.py file of settings.py file of the sample app provided by google and I think this issue is due to some mistake in that setting file or maybe something else. I'm not able to solve the error after lots of attempts.
please help me thank you
Settings.py file
from pathlib import Path
import os
import io
from urllib.parse import urlparse
import environ
from google.cloud import secretmanager
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# [START gaestd_py_django_secret_config]
env = environ.Env(DEBUG=(bool, False))
env_file = os.path.join(BASE_DIR, ".env")
if os.path.isfile(env_file):
# Use a local secret file, if provided
env.read_env(env_file)
# [START_EXCLUDE]
elif os.getenv("TRAMPOLINE_CI", None):
# Create local settings if running with CI, for unit testing
placeholder = (
f"SECRET_KEY=a\n"
f"DATABASE_URL=sqlite://{os.path.join(BASE_DIR, 'db.sqlite3')}"
)
env.read_env(io.StringIO(placeholder))
# [END_EXCLUDE]
elif os.environ.get("GOOGLE_CLOUD_PROJECT", None):
# Pull secrets from Secret Manager
project_id = os.environ.get("GOOGLE_CLOUD_PROJECT")
client = secretmanager.SecretManagerServiceClient()
settings_name = os.environ.get("SETTINGS_NAME", "django_settings")
name = f"projects/{project_id}/secrets/{settings_name}/versions/latest"
payload = client.access_secret_version(name=name).payload.data.decode("UTF-8")
env.read_env(io.StringIO(payload))
else:
raise Exception("No local .env or GOOGLE_CLOUD_PROJECT detected. No secrets found.")
# [END gaestd_py_django_secret_config]
SECRET_KEY = env("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env("DEBUG")
# [START gaestd_py_django_csrf]
# SECURITY WARNING: It's recommended that you use this when
# running in production. The URL will be known once you first deploy
# to App Engine. This code takes the URL and converts it to both these settings formats.
APPENGINE_URL = env("APPENGINE_URL", default=None)
if APPENGINE_URL:
# Ensure a scheme is present in the URL before it's processed.
if not urlparse(APPENGINE_URL).scheme:
APPENGINE_URL = f"https://{APPENGINE_URL}"
ALLOWED_HOSTS = [urlparse(APPENGINE_URL).netloc]
CSRF_TRUSTED_ORIGINS = [APPENGINE_URL]
SECURE_SSL_REDIRECT = True
else:
ALLOWED_HOSTS = ["*"]
# [END gaestd_py_django_csrf]
# Application definition
INSTALLED_APPS = [
'portpolio.apps.PortpolioConfig',
'CRblogs.apps.CrblogsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_social_share',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'crrathod.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'crrathod.wsgi.application'
# Database
# [START db_setup]
# [START gaestd_py_django_database_config]
# Use django-environ to parse the connection string
DATABASES = {"default": env.db()}
# If the flag as been set, configure to use proxy
if os.getenv("USE_CLOUD_SQL_AUTH_PROXY", None):
DATABASES["default"]["HOST"] = "127.0.0.1"
DATABASES["default"]["PORT"] = 8088
# [END gaestd_py_django_database_config]
# [END db_setup]
# Use a in-memory sqlite3 database when testing in CI systems
# TODO(glasnt) CHECK IF THIS IS REQUIRED because we're setting a val above
if os.getenv("TRAMPOLINE_CI", None):
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}
# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
# STATICFILES_DIRS =[
# os.path.join(BASE_DIR, 'static')
# ]
# STATIC_ROOT = os.path.join(BASE_DIR,'assets')
STATIC_URL = 'static/'
MEDIA_URL = '/media/'
if DEBUG:
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
Log file
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\grpc_helpers.py", line 72, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\grpc\_channel.py", line 946, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\grpc\_channel.py", line 849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Permission denied on resource project my-portfolio-361305."
debug_error_string = "{"created":"#1662731782.139000000","description":"Error received from peer ipv6:[2404:6800:4009:825::200a]:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"Permission denied on resource project my-portfolio-361305.","grpc_status":7}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\core\management\__init__.py", line 386, in execute
settings.INSTALLED_APPS
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\conf\__init__.py", line 87, in __getattr__
self._setup(name)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\conf\__init__.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\conf\__init__.py", line 183, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\LONAR\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\crrathod\settings.py", line 50, in <module>
payload = client.access_secret_version(name=name).payload.data.decode("UTF-8")
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\cloud\secretmanager_v1\services\secret_manager_service\client.py", line 1440, in access_secret_version
response = rpc(
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\gapic_v1\method.py", line 154, in __call__
return wrapped_func(*args, **kwargs)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\retry.py", line 283, in retry_wrapped_func
return retry_target(
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\retry.py", line 190, in retry_target
return target()
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\grpc_helpers.py", line 74, in error_remapped_callable
raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.PermissionDenied: 403 Permission denied on resource project my-portfolio-361305. [links {
description: "Google developer console API key"
url: "https://console.developers.google.com/project/ my-portfolio-361305/apiui/credential"
}
, reason: "CONSUMER_INVALID"
domain: "googleapis.com"
metadata {
key: "service"
value: "secretmanager.googleapis.com"
}
metadata {
key: "consumer"
value: "projects/ my-portfolio-361305"
}
]
I just shifted from one problem to another. I did some changes here. I have removed space after = from this cmd set GOOGLE_CLOUD_PROJECT=my-portfolio-361305 previously I was using set GOOGLE_CLOUD_PROJECT= my-portfolio-361305 this cmd. Now I have also removed space after = in secret manager file as I read that in some solutions for my new problem Error in deploying Django app on Google cloud using appengine "django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable".
I got a solution to that problem as well by running set SECRET_KEY=my_secret_key_value
But now got a new problem as after running python manage.py makemigrations
as
RuntimeWarning: Got an error checking a consistent migration history performed for >database connection 'default': connection to server at "127.0.0.1", port 5432>failed: FATAL: password authentication failed for user "CRRathod"
warnings.warn(
No changes detected
It seems here as I have entered the wrong password. But I check that as well
Thank You!
I try to deploy node.js lambda function with CDK python. Unfortunately, I cannot find any tutorials for this combination. Here is what I did.
mkdir hello
cd hello
cdk init app --language python
virtualenv -p python3.7 env
source env/bin/activate
pip install -r requirements.txt
(edit ./app.py and ./code/hello.js)
cdk diff
Then I got the following error. How can I solve this problem?
File "app.py", line 24, in <module>
HelloStack(app, "HelloStack")
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_runtime.py", line 86, in __call__
inst = super().__call__(*args, **kwargs)
File "app.py", line 20, in __init__
entry="./code/hello.js"
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_runtime.py", line 86, in __call__
inst = super().__call__(*args, **kwargs)
File "/home/bitnami/hello/env/lib/python3.7/site-packages/aws_cdk/aws_lambda_nodejs/__init__.py", line 1307, in __init__
jsii.create(self.__class__, self, [scope, id, props])
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_kernel/__init__.py", line 297, in create
for iface in getattr(klass, "__jsii_ifaces__", [])
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_kernel/providers/process.py", line 344, in create
return self._process.send(request, CreateResponse)
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_kernel/providers/process.py", line 326, in send
raise JSIIError(resp.error) from JavaScriptError(resp.stack)
jsii.errors.JSIIError: Cannot find a package lock file (`pnpm-lock.yaml`, `yarn.lock` or `package-lock.json`). Please specify it with `depsLockFilePath`.
Here are the files.
app.py
#!/usr/bin/env python3
import os
import aws_cdk as cdk
from aws_cdk import (
# Duration,
Stack,
aws_lambda_nodejs as lamjs,
)
from constructs import Construct
class HelloStack(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
helloFn = lamjs.NodejsFunction(
self,"hello",
entry="./code/hello.js"
);
app = cdk.App()
HelloStack(app, "HelloStack")
app.synth()
code/hello.js
exports.handler = async(event, context) => {
return 1;
};
Here is my environment.
cdk --version
2.24.1 (build 585f9ca)
npm --version
6.14.15
--- Update on May 25, 2022 ---
I added the following package.json in the hello directory and ran "npm install".
package.json
{
"name": "hello",
"version": "0.1.0",
"bin": {
"hello": "code/hello.js"
},
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "jest",
"cdk": "cdk"
},
"devDependencies": {
"#types/jest": "^27.5.0",
"#types/node": "10.17.27",
"#types/prettier": "2.6.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"aws-cdk": "2.24.1",
"ts-node": "^10.7.0",
"typescript": "~3.9.7"
},
"dependencies": {
"aws-cdk-lib": "2.24.1",
"constructs": "^10.0.0",
"source-map-support": "^0.5.21"
}
}
This makes package-lock.json and then I ran "cdk diff". Then I got the following error.
jsii.errors.JavaScriptError:
Error: spawnSync docker ENOMEM
at Object.spawnSync (internal/child_process.js:1077:20)
at Object.spawnSync (child_process.js:776:24)
at dockerExec (/tmp/jsii-kernel-LhoMqm/node_modules/aws-cdk-lib/core/lib/bundling.js:1:4968)
at Function.fromBuild (/tmp/jsii-kernel-LhoMqm/node_modules/aws-cdk-lib/core/lib/bundling.js:1:3553)
at new Bundling (/tmp/jsii-kernel-LhoMqm/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.js:1:2057)
at Function.bundle (/tmp/jsii-kernel-LhoMqm/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.js:1:2947)
at new NodejsFunction (/tmp/jsii-kernel-LhoMqm/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function.js:1:1361)
at /tmp/tmp5utwlvy5/lib/program.js:8420:58
at Kernel._wrapSandboxCode (/tmp/tmp5utwlvy5/lib/program.js:8848:24)
at Kernel._create (/tmp/tmp5utwlvy5/lib/program.js:8420:34)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "app.py", line 24, in <module>
HelloStack(app, "HelloStack")
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_runtime.py", line 86, in __call__
inst = super().__call__(*args, **kwargs)
File "app.py", line 20, in __init__
entry="./code/hello.js"
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_runtime.py", line 86, in __call__
inst = super().__call__(*args, **kwargs)
File "/home/bitnami/hello/env/lib/python3.7/site-packages/aws_cdk/aws_lambda_nodejs/__init__.py", line 1307, in __init__
jsii.create(self.__class__, self, [scope, id, props])
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_kernel/__init__.py", line 297, in create
for iface in getattr(klass, "__jsii_ifaces__", [])
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_kernel/providers/process.py", line 344, in create
return self._process.send(request, CreateResponse)
File "/home/bitnami/hello/env/lib/python3.7/site-packages/jsii/_kernel/providers/process.py", line 326, in send
raise JSIIError(resp.error) from JavaScriptError(resp.stack)
jsii.errors.JSIIError: spawnSync docker ENOMEM
How can I solve this issue?
From the docs:
The NodejsFunction requires a dependencies lock file (yarn.lock, pnpm-lock.yaml or package-lock.json). When bundling in a Docker container, the path containing this lock file is used as the source (/asset-input) for the volume mounted in the container.
So you would need your lambda folder to have a lock file in one of the supported formats.
this is my first question at Stack overflow. I have been learning Python for about a month and Django for two weeks. I tried to run a second server on my MacBook Pro and then had these problems.(the error messages from my terminal below) The second server included some other applications including Pihole. I deleted the second server files and re-booted, problem solved! The next thing was that I tried editing my Views.py file in Django and then the same error message came back when I re-booted my Django server in the virtual environment folder.
See errors below:
mymac#michaels-MacBook-Pro mfdw_root % python manage.py runserver
Traceback (most recent call last):
File "/Users/mymac/Desktop/mfdw_project/mfdw_root/manage.py", line 22, in <module>
main()
File "/Users/mymac/Desktop/mfdw_project/mfdw_root/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 345, in execute
settings.INSTALLED_APPS
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/conf/__init__.py", line 83, in __getattr__
self._setup(name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/conf/__init__.py", line 70, in _setup
self._wrapped = Settings(settings_module)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/conf/__init__.py", line 177, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 786, in exec_module
File "<frozen importlib._bootstrap_external>", line 923, in get_code
File "<frozen importlib._bootstrap_external>", line 853, in source_to_code
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/mymac/Desktop/mfdw_project/mfdw_root/mfdw_site/settings.py", line 123
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
^
SyntaxError: illegal target for annotation
end of errors********
This is my first question at Stack Overflow and I am very uncertain right now if I will ever get my server running again on my MacBook Pro with Python 3.9.0 and Django 3.1.3
This is the error I get above, and I can't connect to 127.0.0.1 , the localhost on my MacBook Pro.
Please try and give me a clue as to how to proceed. I have been following the lessons of djangobook.com .
Below is my settings.py file:
"""
Django settings for mfdw_site project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '# secret key goes here, it is present in actual code'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'pages.apps.PagesConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'mfdw_site.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'mfdw_site.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
STATICFILES_DIRS = [BASE_DIR / 'mfdw_site/static')]
Also, is there a path problem with my Django installation? I am running on a MacBook Pro which is properly updated to use Python 3.9 . I think it might have something to do with this part of the errors:
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
Does this seem reasonable? The flagged code in settings.py occurs on line 123.
Also it looks to me like python 3.9 has an included django installation which is confused via path with the mfdw_project files.
Am I right and what should I do about it?
Please read the error carefully, it says that your settings file is misconfigured on line 123 and gives you the line that is offending with the ^ as a sign on where it happens:
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
^
and it says there is a syntax error, so you can tell that the problem is you wrote something not according to the syntax of python.
According to this, you should check what is going on on the line before this line (line 122), check what happens if you put this line in comment (with #), it will either find another error on the next line, find an error somewhere later or run smoothly.
If it finds an error on the next line, you can check what you did wrong on the line before this one (line 122).
If it finds an error somewhere later on you can understand the problem is with the actual line (line 122) and it's probably the / you have there, a list sepperator is comma (,), not /...
Edit:
First, thanks for adding the settings file, it helps to find the error after we know what to look for.
The offending line is 123 and it looks like this:
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
This has 3 problems:
The 'DIRS' shouldn't be a string, it should be a variable, so remove the '.
The line shouldn't have a colon, this is not a dictionary or a function definition.
I understand that you want to have the path as BASE_DIR/mfdw_site/templates, assuming so, it can be [f'{BASE_DIR}/mfdw_site/templates'] and a few other options, but this is the easiest
I'm working with an OpenAPI 3.0.1 yaml and it's unable to get the API webserver started due to the below error. I tried almost everything that is under my knowledge but I'm very new at OpenAPI and the documentation was followed as it is. Any thoughts on what could be wrong here?
This is the error on loading up the server:
Failed to add operation for GET /v2/catalog
Traceback (most recent call last):
File "C:\Programs\Python\Python38\lib\site-packages\connexion\apis\abstract.py", line 209, in add_paths
self.add_operation(path, method)
File "C:\Programs\Python\Python38\lib\site-packages\connexion\apis\abstract.py", line 162, in add_operation
operation = make_operation(
File "C:\Programs\Python\Python38\lib\site-packages\connexion\operations\__init__.py", line 8, in make_operation
return spec.operation_cls.from_spec(spec, *args, **kwargs)
File "C:\Programs\Python\Python38\lib\site-packages\connexion\operations\openapi.py", line 128, in from_spec
return cls(
File "C:\Programs\Python\Python38\lib\site-packages\connexion\operations\openapi.py", line 75, in __init__
super(OpenAPIOperation, self).__init__(
File "C:\Programs\Python\Python38\lib\site-packages\connexion\operations\abstract.py", line 96, in __init__
self._resolution = resolver.resolve(self)
File "C:\Programs\Python\Python38\lib\site-packages\connexion\resolver.py", line 40, in resolve
return Resolution(self.resolve_function_from_operation_id(operation_id), operation_id)
File "C:\Programs\Python\Python38\lib\site-packages\connexion\resolver.py", line 64, in resolve_function_from_operation_id
raise ResolverError(msg, sys.exc_info())
connexion.exceptions.ResolverError: <ResolverError: Cannot resolve operationId "catalog.get"! Import error was "No module named 'catalog'">
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\API\swagger_server\__main__.py", line 25, in <module>
main()
File "D:\API\swagger_server\__main__.py", line 18, in main
app.add_api('D:\API\swagger_server\swagger\swagger.yaml', arguments={'title': 'GPI API Broker'}, pythonic_params=True)
File "C:\Programs\Python\Python38\lib\site-packages\connexion\apps\flask_app.py", line 57, in add_api
api = super(FlaskApp, self).add_api(specification, **kwargs)
File "C:\Programs\Python\Python38\lib\site-packages\connexion\apps\abstract.py", line 141, in add_api
api = self.api_cls(specification,
File "C:\Programs\Python\Python38\lib\site-packages\connexion\apis\abstract.py", line 111, in __init__
self.add_paths()
File "C:\Programs\Python\Python38\lib\site-packages\connexion\apis\abstract.py", line 216, in add_paths
self._handle_add_operation_error(path, method, err.exc_info)
File "C:\Programs\Python\Python38\lib\site-packages\connexion\apis\abstract.py", line 231, in _handle_add_operation_error
raise value.with_traceback(traceback)
File "C:\Programs\Python\Python38\lib\site-packages\connexion\resolver.py", line 61, in resolve_function_from_operation_id
return self.function_resolver(operation_id)
File "C:\Programs\Python\Python38\lib\site-packages\connexion\utils.py", line 110, in get_function_from_name
module = importlib.import_module(module_name)
File "C:\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'catalog'
The startup command is basically: python -m swagger_server
Finally, this is part of my YAML where the operationId is mentioned:
openapi: 3.0.1
info:
title: Open Service Broker API
description: The Open Service Broker API defines an HTTP(S) interface between Platforms
and Service Brokers.
contact:
name: Open Service Broker API
url: https://www.openservicebrokerapi.org/
email: open-service-broker-api#googlegroups.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: master - might contain changes that are not yet released
externalDocs:
description: The offical Open Service Broker API specification
url: https://github.com/openservicebrokerapi/servicebroker/
servers:
- url: http://localhost:80/
- url: https://localhost:80/
security:
- basicAuth: []
paths:
/v2/catalog:
get:
tags:
- Catalog
summary: get the catalog of services that the service broker offers
operationId: 'catalog.get'
parameters:
- name: X-Broker-API-Version
in: header
...
Thank you all in advance!
The operationId must be relative to where your app is running.
swagger_server
|-- app.py
|-- __init__.py
|-- OpenAPI
| |-- openapi.yml
|-- models
| |-- catalog.py
Given the above folder structure, you start the app in the directory swagger_server. Consequently, the path of app.py is in your sys.path. Relative to this path you need to specify the operationId in your openapi.yml:
paths:
/v2/catalog:
get:
tags:
- Catalog
summary: get the catalog of services that the service broker offers
operationId: 'models.catalog.get'
The file catalog.py must contain a function def get(name). Here you can define your service/handler for the endpoint. It must include the parameter name because you have specified the parameter in your YAML file.
This is my very first time creating an .exe (or any package at all). Although I successfully created an exe-file of the kivy-touchtracer demo, according to the kivy-manual. I used the same approach to create an .exe from my kivy-app. It suppose to be running only on windows (first milestone).The non-exe version runs as I wanted. I could manage to create an .exe file, but somehow it is not running.Basically the programm should collect some data, "calculate a bit around" the given data, create some plots (matplotlib) and create a report-pdf (reportlab).
I already tried:
copy dateutils from python/Lib/sitepackages/dateutil into the created dist directory. (It helped by reportlab)
modifying the 'from .tz import *' line in dateutil/tz/init to 'from tz import *' (removing the dot)
They appeared useless...
How could I run my exe? What did I miss? (Matplotlib is in the supported-package list of pyinstaller.)
OS: Win7
Python: 3.4
My cal.spec file:
# -*- mode: python -*-
from kivy.deps import sdl2, glew
block_cipher = None
a = Analysis(['C:\\EZS-2G\\main.py'],
pathex=['C:\\EZS-2G\\calApp'],
binaries=None,
datas=None,
hiddenimports=['cycler','pyparsing','setuptools','tkinter','PyPDF2','jinja2','sqlite3','markupsafe','PIL','tornado','pytz','dateutil','reportlab','numpy','matplotlib'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='Cal',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe, Tree('C:\\EZS-2G\\'),
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
strip=False,
upx=True,
name='Cal')
And here is my .kivy/log.txt as a result:
[INFO ] Logger: Record log in C:\Users\kalibrierlabor\.kivy\logs\kivy_16-03-09_74.txt
[INFO ] Kivy: v1.9.1
[INFO ] Python: v3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)]
[INFO ] Factory: 179 symbols loaded
[INFO ] Image: Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] OSC: using <thread> for socket
[INFO ] Window: Provider: sdl2
[INFO ] GL: GLEW initialization succeeded
[INFO ] GL: OpenGL version <b'3.3.0'>
[INFO ] GL: OpenGL vendor <b'NVIDIA Corporation'>
[INFO ] GL: OpenGL renderer <b'GeForce 210/PCIe/SSE2'>
[INFO ] GL: OpenGL parsed version: 3, 3
[INFO ] GL: Shading version <b'3.30 NVIDIA via Cg compiler'>
[INFO ] GL: Texture max size <8192>
[INFO ] GL: Texture max units <32>
[INFO ] Window: auto add sdl2 input provider
[INFO ] Window: virtual keyboard not allowed, single mode, not docked
[INFO ] Text: Provider: sdl2
[WARNING ] stderr: Traceback (most recent call last):
[WARNING ] stderr: File "<string>", line 58, in <module>
[WARNING ] stderr: File "C:\EZS-2G\CETAcalApp\dist\CETA-Cal\cls\plotting.py", line 5, in <module>
[WARNING ] stderr: import matplotlib.pyplot as plt
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\matplotlib\pyplot.py", line 36, in <module>
[WARNING ] stderr: from matplotlib.figure import Figure, figaspect
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\matplotlib\figure.py", line 40, in <module>
[WARNING ] stderr: from matplotlib.axes import Axes, SubplotBase, subplot_class_factory
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\matplotlib\axes\__init__.py", line 4, in <module>
[WARNING ] stderr: from ._subplots import *
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\matplotlib\axes\_subplots.py", line 10, in <module>
[WARNING ] stderr: from matplotlib.axes._axes import Axes
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\matplotlib\axes\_axes.py", line 22, in <module>
[WARNING ] stderr: import matplotlib.dates as _ # <-registers a date unit converter
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\matplotlib\dates.py", line 130, in <module>
[WARNING ] stderr: import dateutil.parser
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\dateutil\parser.py", line 43, in <module>
[WARNING ] stderr: from . import tz
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\dateutil\tz\__init__.py", line 1, in <module>
[WARNING ] stderr: from .tz import *
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\dateutil\tz\tz.py", line 17, in <module>
[WARNING ] stderr: from .__init__ import tzname_in_python2
[WARNING ] stderr: File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING ] stderr: exec(bytecode, module.__dict__)
[WARNING ] stderr: File "C:\Python34\lib\site-packages\dateutil\tz\__init__.py", line 1, in <module>
[WARNING ] stderr: from .tz import *
[WARNING ] stderr: ImportError: No module named 'dateutil.tz.__init__.tz'
I had the same problem (also on windows 7 and Python 3.4 and python-dateutil version 2.5). I did some reading e.g. at https://github.com/dateutil/dateutil/pull/202#issuecomment-192352290. Like you I tried to make some amendments to the dateutil package, but in the end I simply reverted the package to the previous version with pip i.e. 'pip install python-dateutil==2.4.2' and that resolved the issue for me.
I had similar problem. Since everything worked I found a workaround using:
import warnings
warnings.filterwarnings("ignore", category=UserWarning)