python app not starting in visual studio - python

I have created django python app, and when I press F5 , it pops up a python shell which says
Available subcommands:
[auth]
changepassword
createsuperuser
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runfcgi
shell
showmigrations
sql
sqlall
sqlclear
sqlcustom
sqldropindexes
sqlflush
sqlindexes
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
syncdb
test
testserver
validate
[sessions]
clearsessions
[staticfiles]
collectstatic
findstatic
runserver
Press any key to continue . . .
But it does not open any browser and app is not running, when I hit any key , it just stops the app.
I am wondering what is the issue. Weird thing is few days ago this app was working fine and I didn't do anything after that.

I resolved the issue. The issue was with the port 8000, my system was not allowing me to access port number: 8000.
So I went to VisualStudio ---->Debug ----> Project properties at bottom ---> Debug --->enter port number : 5000
and then it worked like charm.

Related

ValueError: Dependency on app with no migrations: account

I am trying to deploy my code in heroku.
While deploying i complete all the steps
but i get error while migrate
i try these command
heroku run python manage.py makemigrations account
While running above command i get
account/migrations/0001_initial.py
- Create model User
but while trying to migrate
I try
heroku run python manage.py migrate account
i get error
raise ValueError("Dependency on app with no migrations: %s" % key[0])
ValueError: Dependency on app with no migrations: account
i also try
heroku run python manage.py makemigrations
heroku run python manage.py migrate
At this time also i get same error
the project is running successfully in localhost
with out any error
I am new to heroku please anyone can help with full instruction
First try to run command heroku run python manage.py showmigrations to see what migrations have been done.
If it returns an empty list, you have to run heroku run python manage.py migrate to migrate the existing migrations.
After that, you can follow the normal procedures in tutorial
python manage.py makemigrations
python manage.py migrate
my case
(heroku.com)
heroku dashboard
↓
app
↓
deploy
↓
Github
↓
Manual deploy
I was able to migrate

"manage.py startapp" doesn't create db.sqlite3

I'm following an online tutorial in order to learn Django/Python. I'm using PyCharm Community Edition as my IDE. On Windows 10.
When I run python manage.py startapp myapp at the (venv) prompt in terminal window , no error is shown, and \myapp folder is created with the expected content. However, the file db.sqlite3 is not created, and I can't follow through the rest of the tutorial.
What might be going wrong here?
Thank you very much.
when you start a new django app no database must created.
you can run command
python manage.py migrate
to generate database for your project.
default database is sqlite and stored in file named db.sqlite3
Command python manage.py startapp myapp does not create db.sqlite3.
Run:
python manage.py makemigrations
python manage.py migrate
It will automatically create one if not present.

manage.py command returns help text

I have a problem with manage.py - it returns 'help' instead of creating an app. I'm quite new in Django so it could be obvious.
I've created a Django project using PyCharm.
New Project../Django../Projct
So PyCharm created a directory called Projct which looks like:
Projct/
Projct/
__init__.py
settings.py
urls.py
wsgi.py
Templates/
manage.py
Now, I want to start on project so I change a name of the SQLite database and do this command:
...PycharmProjects/Projct/manage.py startapp projct
Cmd returns:
Available subcommands
[auth]
changepassword
createsuperuser
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runfcgi
shell
showmigrations
sql
sqlall
sqlclear
sqlcustom
sqldropindexes
sqlflush
sqlindexes
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
syncdb
test
testserver
validate
[sessions]
clearsessions
[staticfiles]
collectstatic
findstatic
runserver
I've already tried syncdb and it returns the same list.
Do you know where is the problem?
Try to do the following in Pycharm Ctrl+Alt+R, when the new window comes up, type in runserver and hit enter.

django: by mistake deleted migration files from production server

By mistake I deleted all the migration files from all apps on production server.
Now running python manage.py makemigrations and then python manage.py migrate raises:
"field already exists in the database"
error for each field, What should I do ?
django version: 1.7.7
If you already migrated and then deleted.Then fake will help you
python manage.py migrate --fake
you have to fake the migration, the next command may help you:
python manage.py migrate 'name_app' 'name_migration' --fake
Example:
python manage.py migrate books 005_auto_20150505 --fake

Unable to migrate Django app with South on Heroku

I've installed South on my existing Django app. This Django app is on Heroku as well.
Without making any changes to the models, I've done the following commands locally:
manage.py schemamigration app_name --initial
manage.py migrate --fake
Then I attempted to push heroku master, and migrate there. But I receive the following:
Running migrations for app_name:
- Nothing to migrate.
- Loading initial data for notecards.
No fixtures found
I get the same message if I try to fake the Heroku migrate.
I figured, this may be ok since technically there is nothing to migrate as the db stays the same.
So I made a small change to one of the models and did the following:
manage.py schemamigration app_name --auto
manage.py migrate
I then pushed to Heroku and attempted to migrate there, and I still receive the following:
Running migrations for app_name:
- Nothing to migrate.
- Loading initial data for notecards.
No fixtures found
Any help with what I'm doing wrong would be great. THanks.
For anyone else who comes across this issue, and for my own reference. Thanks to Chris Pratt for putting me on the right track.
This was resolved by:
Locally:
recursively removing any old migrations git rm -r migrations
flushing old database (this removes all data, but for me this wasnt an issue) manage.py flush
delete migrations folder in app folder
run initial schemamigration manage.py schemamigration --initial
run fake migrate manage.py migrate --fake
push heroku master
On Heroku:
migrate heroku run python manage.py migrate app_name
Then, locally, you can run migrate --auto, push to heroku, and run migrate app_name

Categories

Resources