How to run a Django project without a manage.py file? - python

I'm not experienced with Django. I just want to get this project running on a localhost (on Mac). Normally I run python manage.py runserver inside a virtualenv but I can't do that without a manage.py file! I must be doing something obviously wrong if this project has 264 GitHub stars.
https://github.com/shacker/django-todo
How can I make this work?

First, it's almost impossible to get a project running without manage.py not just because of the server but also the migrations..
Second, the django codes in the github link especially the todo folder is an app of a django project and you need to add that on your INSTALLED_APPS in your settings.py file

setup script is used to install whole project with required dependency packages, once you done with setup script installation then you can import that project into your local project
Goto Project directory and run below commands:
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
Finally u can see the project in the browser http://127.0.0.1:8000

Related

Why do I fail Django migration in heroku server while succeeding in local server?

So I have deployed my Django project to Heroku, and now trying to migrate the database. I have everything working fine in my local sever. Then I tried to run the commands in heroku, as below.
python manage.py makemigrations
This worked fine.
Migrations for 'app_name':
contents\migrations\0001_initial.py
- Create model Book
- Create model Category
- Create model Content
Then of course, I tried : git add .git commit -m "migration" git push heroku master heroku run python manage.py migrate app_name
But then I got this error CommandError: App 'app_name' does not have migrations.
Strange thing is, after running python manage.py migrate, everything works fine in my local server. It's only the heroku server where the error occurs.
I've done some research for possible issues, none of which were relevant to mine.
For example I do have init.py in the migrations folder inside app_name directory. Also, I've tried heroku run python manage.py migrate as well as heroku run python manage.py migrate app_name but neither worked.
I'm very confused. What do you think is the problem? Thanks in advance. :)

Why do I get "CommandError: App 'app_name' does not have migrations." when using Heroku?

So I have deployed my Django project to Heroku, and now trying to migrate the database. I have everything working fine in my local sever. Then I tried to run the commands in heroku, as below.
heroku run python manage.py makemigrations app_name'.
This worked fine.
Migrations for 'app_name':
contents\migrations\0001_initial.py
- Create model Book
- Create model Category
- Create model Content
Then of course, I tried : heroku run python manage.py migrate app_name.
But then I got this error CommandError: App 'app_name' does not have migrations.
I've done some research for possible issues, none of which were relevant to mine.
For example I do have __init__.py in the migrations folder inside app_name directory. Also, I've tried heroku run python manage.py migrate as well as heroku run python manage.py migrate app_name. I'm very confused. What do you think is the problem? Thanks in advance. :)
I had the same problem, I don't know why, but the following works for me (two commands in one line):
python manage.py makemigrations && python manage.py migrate app_name
As explained in heroku's help article Why are my file uploads missing/deleted?:
The Heroku filesystem is ephemeral - that means that any changes to
the filesystem whilst the dyno is running only last until that dyno is
shut down or restarted.
That is you do generate the migration files but they cease to exist shortly after when the app is reloaded.
In general the strategy you take is not a good approach to migrations as this can cause various issues, let's say you have multiple production servers each generates their own migrations this causes a conflict! In your situation suppose you do migrate this way and then later you want to add some new models this again will cause you problems.
One should always add their migrations to the version control (git, etc.) commit them and push them to production (here your heroku dyno). That is run python manage.py makemigrations locally, commit the generated migrations, push them and then run heroku run python manage.py migrate.

Django 2.1 created migration with makemigrations did not show up in migrations folder

The migration process runs within a docker environment.
After running docker-compose run web python manage.py makemigrations terminal showed
Migrations for 'api_app':
api_app/migrations/0004_analysis_error.py
But the file didn't show up in the local directory. I ran docker-compose run web python manage.py migrate and it even showed:
Applying api_app.0004_analysis_error... OK
But still no api_app.0004_analysis_error.py in the local directory.
I also tried making an empty migration, the same behavior occurred.
I also tried removing the changes and resetting the migrations, no changes were detected (even though there were).
The application name has been included in the [INSTALLED_APP] module in settings.py.
The issue is similar to this:
Why am I unable to run django migrations via the 'docker-compose run web' command?
When running docker-compose run it created the migration file in the new container but not copied to local.
To grab the file out of the container:
Copying files from Docker container to host

How do i fix this issue with django start project?

After I installed django i wrote the start project command to verify django is working or not.
i.e,
django-admin startproject mysite
cd mysite
python manage.py runserver
After that I got an IP address(http://127.0.0.1:8000/)
but when i link to this http://127.0.0.1:8000/, it is showing unable to connect. what should i do now?
Don't worry this is not a big issue!
As per your comment mentioned above, Run the python manage.py runserver then go to new instance of powershell and do other stuff what you want to try.
Let that runserver window isolated.

Cannot Deploy Pyramid Application on Heroku

I am having issues deploying my Pyramid app on Heroku. It runs fine locally but as soon as I try to launch it I receive this error "pkg_resources.DistributionNotFound: mymedaproject". mymedaproject is the name of my project and is not a python library which is why I am confused. I followed the instructions from this recipe to get to this point:
http://pyramid-cookbook.readthedocs.org/en/latest/deployment/heroku.html
Any ideas?
May be you forgot to put your python project mymedaproject in development mode. What follows is the relevant part of the cookbook recipe.
Create a Procfile
$ echo "web: ./run" > Procfile
Create run with the following:
#!/bin/bash
python setup.py develop
python runapp.py
The first line puts your python project in development mode and enables Paste to load it using your INI file. Make sure Procfile, run, runapp.py and setup.py are in same directory.
References
Getting Started with Python on Heroku
Process Types and the Procfile
Optimization
running a script using a Procfile should work without making it executable
$ echo "web: sh ./run" > Procfile
Check your .gitignore file that it isn't blocking any egg or egg-info information.
If it is, Heroku won't be receiving the egg for your application.

Categories

Resources