I know there are a number of these questions, but none seem to solve my issue.
I'm running ruby SASS via django-pipelines.
During deployment, pipelines compiles some SASS files through the command python manage.py collectstatic --noinput which is done by Heroku automatically.
Previously I had no problems deploying this. I've recently come back to the code and now when I deploy to Heroku, I receive the following errors (full error log can be found here):
File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/compilers/__init__.py", line 126, in execute_command
"{0!r} exit code {1}\n{2}".format(argument_list, compiling.returncode, stderr))
pipeline.exceptions.CompilerError: ['/usr/bin/env', 'sass', '--load-path', '/app/app/static', '--load-path', '/app/app2/static', u'/app/staticfiles/app2/stylesheets/app2.scss', u'/app/staticfiles/app2/stylesheets/app2.css'] exit code 1
/tmp/build_8d2e04464970e15667c8f825fc387c8a/myapp-8b763976868799a3f147ac8cedbd82421efa7525/vendor/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler/setup (LoadError)
from /tmp/build_8d2e04464970e15667c8f825fc387c8a/myapp-8b763976868799a3f147ac8cedbd82421efa7525/vendor/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /tmp/build_8d2e04464970e15667c8f825fc387c8a/myapp-8b763976868799a3f147ac8cedbd82421efa7525/vendor/bundle/bin/sass:14:in `<main>'
! Error while running '$ python manage.py collectstatic --noinput'.
As you can see, I've deployed using Ruby 2.2.2 previously, but now bundler has been updated on Heroku from 1.9.7 to 1.11.2.
Sass is the same version (3.4.19).
Line 14 of bin/sass from the last successful deployment on heroku.
$ sass --version
Sass 3.4.19 (Selective Steve)
$ cat ./vendor/bundle/bin/sass | sed '14!d'
require 'bundler/setup'
$ bundle --version
Bundler version 1.9.7
Curiously, the contents of my local version of bin/sass look nothing like the one on Heroku.
$ cat ~/.rvm/gems/ruby-2.2.2#app/bin/sass | sed '14!d'
str = ARGV.first
Locally, I'm running Ruby 2.2.2 and have tried both bundler 1.10.6 and 1.11.2.
Here is my Gemfile:
source 'https://rubygems.org'
ruby '2.2.2'
gem 'sass', '3.4.19'
I had the same problem as yours and found that the only solution was to switch out the SASS Compiler with Compass Compiler (installed with the django-pipeline-compass package). See Andrew's answer here: https://stackoverflow.com/a/31420009/6080975
Related
Anyone kind enough to tell me what should the build command be? Also what should there be in the publish directory (I named it dist and it has an empty index.html). My build script right now is:
#!/usr/bin/env bash
# exit on error
set -o errexit
python manage.py collectstatic --no-input
python manage.py migrate
I have a question need your help~
I have a django program run in a vps(centos7,django2.2),it works well with Nginx+Uwsgi.
I edit three files(like a.py b.py c.py),and upload to the vps by winscp.exe,the program can't work now.
I found these logs in the uwsgi.log file.
File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 68, in <module>
check_sqlite_version()
File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 65, in check_sqlite_version
raise ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version)
django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).
unable to load app 0 (mountpoint='') (callable not found or import error)
I wrote "sqlite3 --version" in centos7 shell, it show version = 3.30.1
I wrote "python >>> import sqlite3 >>>print sqlite3.sqlite_version" it show version=3.30.1
I wrote "python manage.py runserver --noreload 0.0.0.0:80",it works well, no info show sqlite error.
But the program can't work in uwsgi,I think the uwsgi.ini is correct.
What can I do ?
Thank you!
I think I have solved this question.
In centos shell:
> mv /usr/lib64/libsqlite3.so.0.8.6 /usr/lib64/libsqlite3.so.0.8.6_old
> cp /usr/local/lib/libsqlite3.so.0.8.6 /usr/lib64/libsqlite3.so.0.8.6
then it's ok
uwsgi has RPATH set. and its' /usr/lib64, and the old sqlite library is in this directory, you need to use the newer sqlite library in /usr/local/lib.
you could recompile uwsgi like this: sudo LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib" pip3 install uwsgi.
refrence: https://sourceexample.com/en/1c4153d4c3d4e65dac45/
I am trying to build a Django project with Travis
My builds keep showing the error below
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
/home/travis/build.sh: line 298: syntax error in conditional expression
/home/travis/build.sh: line 298: syntax error near `2.7/bin/activate'
/home/travis/build.sh: line 298: `if [[ ! -f ~/virtualenv/python– 2.7/bin/activate ]]; then'
Here is my .travis.yml file:
language: python
services:
– mysql
python:
– 2.7
env:
- DJANGO=1.9.2
before_install:
- export DJANGO_SETTINGS_MODULE=happny.settings.travis
install:
– pip install -r requirements/test.txt
before_script:
– python manage.py makemigrations
– python manage.py migrate
script:
– python manage.py test
branches:
only:
- master
The problem was the dash (-) character in the yaml file. Copying from a web page resulted in some formatting mismatch
I noticed the length of the dash was longer than normal. I fixed it by retyping the .travis.yml file by hand.
Try wrapping the python version in ""
python:
- "2.7"
I'm trying to run a Python script I've uploaded as part of my AWS Elastic Beanstalk application from my development machine, but can't figure out how to. I believe I've located the script correctly, but when I attempt to run it under SSH, I get an import error.
For example, I have a Flask-Migrate migration script as part of my application (pretty much the same as the example in the documentation), but after successfully SSHing to my EB instance with
> eb ssh
and locating the script with
$ sudo find / -name migrate.py
when I run in the directory (/opt/python/current) where I located it with
$ python migrate.py db upgrade
at the SSH prompt I get
Traceback (most recent call last):
File "db_migrate.py", line 15, in <module>
from flask.ext.script import Manager
ImportError: No module named flask.ext.script
even though my requirements.txt (present along with the rest of my files in the same directory) has flask-script==2.0.5.
On Heroku I can accomplish all of this in two steps with
> heroku run bash
$ python migrate.py db upgrade
Is there equivalent functionality on AWS? How do I run a Python script that is part of an application I uploaded in an AWS SSH session? Perhaps I'm missing a step to set up the environment in which the code runs?
To migrate your database the best is to use container_commands, they are commands that will run every time you deploy your application. There is a good example in the EBS documentation (Step 6) :
container_commands:
01_syncdb:
command: "django-admin.py syncdb --noinput"
leader_only: true
The reason why you're getting an ImportError is because EBS installs your packages in a virtualenv. Before running arbitrary scripts in your application in SSH, first change to the directory containing your (latest) code with
cd /opt/python/current
and then activate the virtualenv
source /opt/python/run/venv/bin/activate
and set the environment variables (that your script probably expects)
source /opt/python/current/env
I'm trying to get django-cron to work on a winXP machine. (Wish I could use *nix).
Done
pip install django-cron
Added django_cron to INSTALLED_APPS in settings.py.
Then from windows console, ran below command
python manage.py syncdb
The result I got is:
"Not synced (use migrations):
`- django_cron`
(use ./manage.py migrate to migrate these)"
OK, So as per instructions from error msg I did, C:\ python manage.py migrate. Result is as follow:
Running migrations for django_cron:
- Nothing to migrate.
- Loading initial data for django_cron.
Installed 0 object(s) from 0 fixture(s)
Now what? What should I Google in order to figure out what's wrong with the migration?
Did I installed django-cron on the appropriate location?
Right now it's in
python27\Lib\site-packages\django_cron