[gitec] SAPL 3.1

Wesley Lima wesley.davar em gmail.com
Sexta Outubro 7 08:26:12 BRT 2016


No email anterior, a msg de erro foi antes de excluir a pasta sapl. Depois
clonei novamente e ao fazer o ./manage.py migrate dá essa msg de erro

(sapl) bash-4.3$ ./manage.py migrate
Operations to perform:
  Apply all migrations: protocoloadm, auth, norma, parlamentares, sessao,
base, contenttypes, materia, sessions, comissoes, lexml, easy_thumbnails,
painel, compilacao, admin
Running migrations:
  Rendering model states... DONE
  Applying base.0020_auto_20161006_0950...Traceback (most recent call last):
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/utils.py",
line 64, in execute
    return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: column "texto_articulado_materia" of relation
"base_appconfig" already exists


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/__init__.py",
line 353, in execute_from_command_line
    utility.execute()
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/__init__.py",
line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/base.py",
line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/base.py",
line 399, in execute
    output = self.handle(*args, **options)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/commands/migrate.py",
line 200, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/executor.py",
line 92, in migrate
    self._migrate_all_forwards(plan, full_plan, fake=fake,
fake_initial=fake_initial)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/executor.py",
line 121, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake,
fake_initial=fake_initial)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/executor.py",
line 198, in apply_migration
    state = migration.apply(state, schema_editor)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/migration.py",
line 123, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state,
project_state)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/operations/fields.py",
line 62, in database_forwards
    field,
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/base/schema.py",
line 396, in add_field
    self.execute(sql, params)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/base/schema.py",
line 110, in execute
    cursor.execute(sql, params)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/utils.py",
line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/utils.py",
line 64, in execute
    return self.cursor.execute(sql, params)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/utils.py",
line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/utils/six.py",
line 685, in reraise
    raise value.with_traceback(tb)
  File
"/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/utils.py",
line 64, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column "texto_articulado_materia" of
relation "base_appconfig" already exists



Em 7 de outubro de 2016 08:11, Wesley Lima <wesley.davar em gmail.com>
escreveu:

> Bom dia.
>
> Hoje ao atualizar o sapl 3.1 na minha máquina local deu erro.
>
> Atualizei via git pull --rebase, ao fazer o migrate deu erro.
>
> (sapl) bash-4.3$ ./manage.py migrate
> Operations to perform:
>   Apply all migrations: comissoes, easy_thumbnails, admin, protocoloadm,
> contenttypes, lexml, sessao, parlamentares, sessions, painel, base,
> compilacao, norma, auth, materia
> Running migrations:
>   Rendering model states... DONE
>   Applying base.0020_auto_20161006_0950...Traceback (most recent call
> last):
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/utils.py",
> line 64, in execute
>     return self.cursor.execute(sql, params)
> psycopg2.IntegrityError: duplicate key value violates unique constraint
> "django_migrations_pkey"
> DETAIL:  Key (id)=(253) already exists.
>
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File "./manage.py", line 10, in <module>
>     execute_from_command_line(sys.argv)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/core/management/__init__.py", line 353, in
> execute_from_command_line
>     utility.execute()
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/core/management/__init__.py", line 345, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/core/management/base.py", line 348, in run_from_argv
>     self.execute(*args, **cmd_options)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/core/management/base.py", line 399, in execute
>     output = self.handle(*args, **options)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/core/management/commands/migrate.py", line 200, in handle
>     executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/db/migrations/executor.py", line 92, in migrate
>     self._migrate_all_forwards(plan, full_plan, fake=fake,
> fake_initial=fake_initial)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/db/migrations/executor.py", line 121, in _migrate_all_forwards
>     state = self.apply_migration(state, migration, fake=fake,
> fake_initial=fake_initial)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/db/migrations/executor.py", line 204, in apply_migration
>     self.recorder.record_applied(migration.app_label, migration.name)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/db/migrations/recorder.py", line 73, in record_applied
>     self.migration_qs.create(app=app, name=name)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/models/query.py",
> line 401, in create
>     obj.save(force_insert=True, using=self.db)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/models/base.py",
> line 708, in save
>     force_update=force_update, update_fields=update_fields)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/models/base.py",
> line 736, in save_base
>     updated = self._save_table(raw, cls, force_insert, force_update,
> using, update_fields)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/models/base.py",
> line 820, in _save_table
>     result = self._do_insert(cls._base_manager, using, fields, update_pk,
> raw)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/models/base.py",
> line 859, in _do_insert
>     using=using, raw=raw)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/models/manager.py",
> line 122, in manager_method
>     return getattr(self.get_queryset(), name)(*args, **kwargs)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/models/query.py",
> line 1039, in _insert
>     return query.get_compiler(using=using).execute_sql(return_id)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/
> django/db/models/sql/compiler.py", line 1060, in execute_sql
>     cursor.execute(sql, params)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/utils.py",
> line 79, in execute
>     return super(CursorDebugWrapper, self).execute(sql, params)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/utils.py",
> line 64, in execute
>     return self.cursor.execute(sql, params)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/utils.py",
> line 95, in __exit__
>     six.reraise(dj_exc_type, dj_exc_value, traceback)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/utils/six.py",
> line 685, in reraise
>     raise value.with_traceback(tb)
>   File "/home/sapl/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/utils.py",
> line 64, in execute
>     return self.cursor.execute(sql, params)
> django.db.utils.IntegrityError: duplicate key value violates unique
> constraint "django_migrations_pkey"
> DETAIL:  Key (id)=(253) already exists.
>
>
> Em 6 de outubro de 2016 19:35, Marcio Vilas Boas <
> marcio em divinopolis.mg.leg.br> escreveu:
>
>> Em 06-10-2016 19:25, Marcio Vilas Boas escreveu:
>>
>> Em 06-10-2016 18:00, wando em formosadooeste.pr.leg.br escreveu:
>>
>> Em 2016-09-30 20:00, Edward de Oliveira Ribeiro escreveu:
>>
>> Olá,
>>
>> Nós temos uma pessoa que está trabalhando nesta parte da migração
>> de dados. Na segunda, vou pedir para ele entrar em contato contigo
>> para ver se consegue te ajudar a resolver o problema, ok?
>>
>> Se vc precisar de uma base de testes fictícia para ter uma idéia do
>> uso do sistema, podemos fornecer também.
>>
>> Att,
>>
>> Edward​
>>
>> -------------------------
>>
>> DE: gitec-bounces em listas.interlegis.gov.br
>> <gitec-bounces em listas.interlegis.gov.br>
>> <gitec-bounces em listas.interlegis.gov.br> em nome de Marcio Vilas Boas
>> <marcio em divinopolis.mg.leg.br> <marcio em divinopolis.mg.leg.br>
>> ENVIADO: sexta-feira, 30 de setembro de 2016 15:37
>> PARA: Grupo Interlegis de Tecnologia
>> ASSUNTO: Re: [gitec] SAPL 3.1
>>
>> Ao rodar este comando único _pip install_ abaixo, deu erro.
>> Acrescentei --upgrade, rodou, mas no final deu esta msg
>> _COMMAND "PYTHON SETUP.PY EGG_INFO" FAILED WITH ERROR CODE 1 IN
>> /TMP/PIP-BUILD-2HUO21EX/MYSQLCLIENT/_
>>
>> Em 30-09-2016 08:28, Leandro Roberto Silva escreveu:
>>
>> opa...
>>
>> o processo de migração pode ser rodado quantas vezes você
>> quiser...
>> para resolver o problema do mysqldb, é necessário rodar uma única
>> vez essa instrução:
>>
>> pip install -r requirements/migration-requirements.txt
>>
>> Leandro, pra não mexer no servidor em produção, dá pra copiar o
>> banco para algum lugar no 3.1 e fazer o procedimento?
>> SIM, BASTA FAZER UMA CÓPIA DA BASE DO MYSQL, COLOCAR EM QUALQUER
>> OUTRA INSTALAÇÃO E, NO ARQUIVO SAPL.LEGACY_MIGRATION_SETTINGS
>> APONTAR PARA ESSA INSTALAÇÃO
>>
>> E o Data.fs e DocumentosfSapl.fs como é que vem pro 3.1?
>> A MIGRAÇÃO DE ARQUIVOS NÃO ESTÁ PRONTA, POR ENQUANTO ESTÁ
>> MIGRANDO APENAS A BASE DE DADOS...
>>
>> Em qui, 29 de set de 2016 às 16:36, Marcio Vilas Boas
>> <marcio em divinopolis.mg.leg.br> <marcio em divinopolis.mg.leg.br> escreveu:
>>
>> Leandro,
>>
>> Fiz outra  instalação completa do 2.5 para migar de lá.
>> Ao executar ./manage.py shell_plus
>> --settings=sapl.legacy_migration_settings
>> Não importa  'MySQLdb', o que pode ser?
>>
>> _(sapl) sapl31 em ubuntu-server16-sapl:~/Envs/sapl$ ./manage.py
>> shell_plus --settings=sapl.legacy_migration_settings_
>>
>> _/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/utils.py:316:
>>
>>
>> RemovedInDjango110Warning: The signature of allow_migrate has
>> changed from allow_migrate(self, db, model) to allow_migrate(self,
>> db, app_label, model_name=None, **hints). Support for the old
>> signature will be removed in Django 1.10._
>> _  RemovedInDjango110Warning)_
>>
>> _Traceback (most recent call last):_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/
>> django/db/backends/mysql/base.py",
>>
>> line 25, in <module>_
>> _    import MySQLdb as Database_
>> _ImportError: No module named 'MySQLdb'_
>>
>> _During handling of the above exception, another exception
>> occurred:_
>>
>> _Traceback (most recent call last):_
>> _  File "./manage.py", line 10, in <module>_
>> _    execute_from_command_line(sys.argv)_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/
>> django/core/management/__init__.py",
>>
>> line 353, in execute_from_command_line_
>> _    utility.execute()_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/
>> django/core/management/__init__.py",
>>
>> line 345, in execute_
>> _    self.fetch_command(subcommand).run_from_argv(self.argv)_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/
>> django/core/management/base.py",
>>
>> line 348, in run_from_argv_
>> _    self.execute(*args, **cmd_options)_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/
>> django/core/management/base.py",
>>
>> line 398, in execute_
>> _    self.check()_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/
>> django/core/management/base.py",
>>
>> line 426, in check_
>> _    include_deployment_checks=include_deployment_checks,_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/
>> django/core/checks/registry.py",
>>
>> line 75, in run_checks_
>> _    new_errors = check(app_configs=app_configs)_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/
>> django/core/checks/model_checks.py",
>>
>> line 28, in check_all_models_
>> _    errors.extend(model.check(**kwargs))_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/models/base.py",
>>
>>
>> line 1180, in check_
>> _    errors.extend(cls._check_long_column_names())_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/models/base.py",
>>
>>
>> line 1595, in _check_long_column_names_
>> _    connection = connections[db]_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/utils.py",
>>
>>
>> line 212, in __getitem___
>> _    backend = load_backend(db['ENGINE'])_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/utils.py",
>>
>>
>> line 116, in load_backend_
>> _    return import_module('%s.base' % backend_name)_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/importlib/__init__.py",
>>
>> line 126, in import_module_
>> _    return _bootstrap._gcd_import(name[level:], package, level)_
>> _  File "<frozen importlib._bootstrap>", line 986, in _gcd_import_
>> _  File "<frozen importlib._bootstrap>", line 969, in
>> _find_and_load_
>> _  File "<frozen importlib._bootstrap>", line 958, in
>> _find_and_load_unlocked_
>> _  File "<frozen importlib._bootstrap>", line 673, in
>> _load_unlocked_
>> _  File "<frozen importlib._bootstrap_external>", line 665, in
>> exec_module_
>> _  File "<frozen importlib._bootstrap>", line 222, in
>> _call_with_frames_removed_
>> _  File
>>
>> "/home/sapl31/.virtualenvs/sapl/lib/python3.5/site-packages/
>> django/db/backends/mysql/base.py",
>>
>> line 28, in <module>_
>> _    raise ImproperlyConfigured("Error loading MySQLdb module: %s" %
>> e)_
>> _django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
>> module: No module named 'MySQLdb'_
>> _(sapl) sapl31 em ubuntu-server16-sapl:~/Envs/sapl$ _
>>
>> Em 29-09-2016 15:53, Marcio Vilas Boas escreveu:
>>
>> Leandro, pra não mexer no servidor em produção, dá pra copiar o
>> banco para algum lugar no 3.1 e fazer o procedimento?
>> E o Data.fs e DocumentosfSapl.fs como é que vem pro 3.1?
>>
>> abs,
>>
>> Em 29-09-2016 08:50, Leandro Roberto Silva escreveu:
>>
>> Olá Marcio
>>
>> Em qua, 28 de set de 2016 às 14:26, Marcio Vilas Boas
>> <marcio em divinopolis.mg.leg.br> <marcio em divinopolis.mg.leg.br> escreveu:
>>
>> Certinho Leandro, positivo e operante rs
>> Já dá pra testar com uma base do 2.5 ?
>>
>> abs
>>
>> Dá pra testar sim... tem um procedimentozinho pra fazer...
>>
>> a configuração para o banco do 3.1 é feita no .env...
>> para a solução de migração saber onde está seu sapl 2.5, vc
>> deve configurar esse arquivo
>>
>> https://github.com/interlegis/sapl/blob/master/sapl/legacy_m
>> igration_settings.py
>>
>>
>> fazê-lo apontar para o banco do 2.5, além de dar as devidas
>> permissões lá no mysql...
>>
>> ATENÇÃO: faça cópia antes... talvez até restaure com outro nome
>> de banco de dados e aponte o legacy, citado acima, para essa
>> restauração
>>
>> com o banco configurado, vc deve entrar no prompt no python assim:
>> ./manage.py shell_plus --settings=sapl.legacy_migration_settings
>>
>> estando no prompt, digitar:
>> %run sapl/legacy/migration.py
>> migrate()
>>
>> enquanto executa o migrate, vá beber um café! ;)
>>
>> se der algum problema,
>> possivelmente a estrutura de sua base 2.5 está diferente da
>> oficial, encontrada aqui:
>>
>> https://colab.interlegis.leg.br/browser/publico/ILSAPL/trunk
>> /instalacao/sapl.sql
>>
>>
>> diferenças na base são permitidas na migração mas pode ocorrer
>> de causar erro...
>> por exemplo:
>> se na base oficial do 2.5 um campo é VARCHAR(30), na versão
>> oficial do 3.1 também é de tamanho 30. Se, por algum motivo,
>> alguém da sua casa legislativa, alterou isso para VARCHAR(50) e
>> existe registros que usa esse espaço excedente, na migração
>> ocorrerá erro... caberá a você, ajustar sua base, para rodar
>> novamente o migrate
>> --
>>
>> att.
>> Leandro Roberto Silva
>> Câmara Municipal de Jataí
>>
>>
>> --
>> _Márcio Vilas Boas_
>> _Consultoria de Informática_
>> _CM - Divinópolis - MG_
>> _(37) 2102-8236_
>>
>> --
>> _Márcio Vilas Boas_
>> _Consultoria de Informática_
>> _CM - Divinópolis - MG_
>> _(37) 2102-8236_ --
>> Histórico do grupo:
>> http://colab.interlegis.leg.br/search/?type=thread&order=lat
>> est&list=gitec
>>
>> Regras de participação:
>> http://colab.interlegis.leg.br/wiki/ComoParticiparComunidade
>>
>> Para administrar ou excluir sua conta visite:
>> https://listas.interlegis.gov.br/mailman/listinfo/gitec
>> --
>>
>> att.
>> Leandro Roberto Silva
>> Câmara Municipal de Jataí
>>
>> --
>> _Márcio Vilas Boas_
>> _Consultoria de Informática_
>> _CM - Divinópolis - MG_
>> _(37) 2102-8236_
>>
>>
>> Boa tarde amigos ! Que local está a descrição versão do SAPL ??
>>
>>     Logue e vai em Painel de Controle, a versão tá lá. Isto no 2.5 se for
>> no 3.1, não sei onde.
>>
>>     abs,
>>
>> --
>> *Márcio Vilas Boas*
>> *Consultoria de Informática*
>> *CM - Divinópolis - MG*
>> *(37) 2102-8236*
>>
>>
>>
>>
>> --
>> *Márcio Vilas Boas*
>> *Consultoria de Informática*
>> *CM - Divinópolis - MG*
>> *(37) 2102-8236*
>>
>> --
>> Histórico do grupo:
>> http://colab.interlegis.leg.br/search/?type=thread&order=lat
>> est&list=gitec
>>
>> Regras de participação:
>> http://colab.interlegis.leg.br/wiki/ComoParticiparComunidade
>>
>> Para administrar ou excluir sua conta visite:
>> https://listas.interlegis.gov.br/mailman/listinfo/gitec
>>
>
>
>
> --
>
>
> *Wesley Lima+55 86 9 9956-7865*
>
> *fb.com/wesleylima247 <http://fb.com/wesleylima247>*
>
> *@wesleylima247 <http://www.twitter.com/wesleylima247>*
>
> *skype: wesleylima_*
>
> *ACREDITO NO VALOR COMPARTILHADO, EM QUE TODOS PODEM GANHAR E
> COMPARTILHAR: AS PESSOAS, EMPRESAS E O PLANETA.*
>



-- 


*Wesley Lima+55 86 9 9956-7865*

*fb.com/wesleylima247 <http://fb.com/wesleylima247>*

*@wesleylima247 <http://www.twitter.com/wesleylima247>*

*skype: wesleylima_*

*ACREDITO NO VALOR COMPARTILHADO, EM QUE TODOS PODEM GANHAR E COMPARTILHAR:
AS PESSOAS, EMPRESAS E O PLANETA.*
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.interlegis.gov.br/pipermail/gitec/attachments/20161007/e3b416d6/attachment.html>


Mais detalhes sobre a lista de discussão GITEC