migrate

Setting Django 'unique' model field parameter after creation of model objects with non-unique values for that field?

人盡茶涼 提交于 2019-12-25 07:03:04
问题 I have a 'project' Model and I've created 4 of them with the names 'Alan Parson's', 'Gutenberg', 'Gutenberg' and 'X.' I just realized, I want the names to be unique, so I set unique = True on the project.name field Now, I can't create another 'Gutenberg' or 'X' or whatever, but django has no issue with the fact that previous models have non-unique names. How is django ensuring uniqueness of the new fields? Why doesn't it matter that old ones are non-unique, and -in general- is there anyway to

How to copy between Subversion repositories preserving properties but not preserving history

梦想与她 提交于 2019-12-25 06:59:57
问题 How can I copy a folder from one existing Subversion repository to another without preserving history , and in such a way that preserves relevant svn properties (e.g. preserve svn:ignore , svn:eol-style but ignore svn:mergeinfo ). To use svn export followed by svn import would not preserve svn properties, so this is not good. We are currently experimenting with: svnadmin dump /path/to/repo1 -r HEAD | svndumpfilter include project/to/keep | svnadmin load /path/to/repo2 But so far we have not

How do I migrate an Amazon EC2 Instance to a different account

自闭症网瘾萝莉.ら 提交于 2019-12-25 02:43:20
问题 Currently we are hosting a customer's instance in our Amazon EC2 Account. We would like to move this to the customer's account so that the billing is transferred. Is there an easy way to simply migrate an instance to a different Amazon Cloud account? 回答1: No, you cannot move an running instance from one account to another. You can however create an AMI of that instance and share the AMI with the other account. Take note of "Sharing an AMI with Specific Users": http://aws.amazon.com/articles

Flask-Migrate “ModuleNotFoundError”

僤鯓⒐⒋嵵緔 提交于 2019-12-24 18:31:20
问题 I'm trying to make migrations on my Flask api based on SQLite db. Here is my project structure ├── app.py ├── blueprints ├── conf.py ├── db.sqlite ├── __init__.py ├── migrations ├── models.py └── templates Then i initialize my migrate class in the app.py from flask import Flask, jsonify, request, render_template from flask_sqlalchemy import SQLAlchemy from conf import ErrorResponses, SuccessResponses # initialization app = Flask(__name__) db = SQLAlchemy(app) from models import User, db,

Django Postgresql dropping column defaults at migrate

老子叫甜甜 提交于 2019-12-24 03:27:45
问题 i'm facing an issue with defaults values of tables. for example i have this model: class model1(models.Model): field1 = models.CharField(max_length=50, default='My Default Value 1',db_column='field1') field2 = models.CharField(max_length=10) class Meta: db_table = 'model1' and the postgresql table is generated without the default: mydb=# \d model1 Table "public.model1" Column | Type | Modifiers --------+-----------------------+----------------------------------------------------- id | integer

from django.db import models, migrations ImportError: cannot import name migrations

核能气质少年 提交于 2019-12-23 06:56:54
问题 So I've started to experience some issues with south on my Django web server. Migrate command is failing with this output everytime: from django.db import models, migrations ImportError: cannot import name migrations (Above this the error displays the rout to the file that failed to be migrated) My Django version is 1.5.1, while my south version is 0.8.4 The thing that troubles me the most is that the module django.db.migrations is nowhere to be found. Any ideas? 回答1: Migrations were

ImportError: No module named

守給你的承諾、 提交于 2019-12-22 18:00:37
问题 I'm migrating PyVisa from Python 2.6 to Python 3.2. I'm able to install the module. It's listed in C:\Python32\Lib\site-packages\pyvisa The __init__.py file imports a module ( vpp43.py ) from this folder. At this line I get following error: Traceback (most recent call last): File "D:\Documents and Settings\grknbl16\My Documents\PatternControl.py", line 2, in <module> from taborAwg import configTabor File "D:\Documents and Settings\grknbl16\My Documents\taborAwg.py", line 1, in <module> from

how to seed in Yii?

醉酒当歌 提交于 2019-12-22 09:06:48
问题 I'm wondering how one can seed in Yii a table once it is created with migration? I've got a migration with an up-method: public function up() { $this->createTable('users',array('id'=>"pk", 'login'=>'string NOT NULL')); echo "table 'users' is created.\n"; return true; } I've got as well corresponding Users model and its CRUD actions . When I try to execute another migration with an up-method public function up() { $user = new Users; $user->login = "Bob"; return $user->save(); } I get the

heroku : run rake db:migrate error

半世苍凉 提交于 2019-12-21 21:37:59
问题 Running `rake db:migrate` attached to terminal... failed ! Multiple apps in folder and no app specified. ! Specify app with --app APP. I get the above error in my terminal when I try to run rake db:migrate can anyone please help? 回答1: As the error clearly states, you need to specify which app you wish to run the command for. If you are inside of the project directory, you shouldn't need to specify the app. If you are outside of your projects folder run the command like so: heroku run rake db

trouble with python manage.py migrate -> No module named psycopg2

孤街浪徒 提交于 2019-12-20 02:11:29
问题 I am having some trouble with migrating Django using postgresql. This is my first time with Django, and I am just following the tutorial. As suggested on the Django website, I have created a virtualenv to run the Django project. Next, I created a postgresql database with these settings: In settings.py I have set these values for the database: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'django_tutorial', 'USER': 'johan', 'PASSWORD': '1234', } } When