Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I'm trying to deploy my Django app on Heroku. The build is successful, but the deployment fails with django.db.utils.ProgrammingError: relation "app_label" does not exist.
I'm deploying directly from GitHub; the repo is public.
I already looked for advice online and added try-except around the urlpatterns as suggested here, but it didn't help.
I also have all the migrations committed.
Now I'm not sure what might have caused the problem or how to fix it.
I have successfully deployed another Django and proceeded the same way now, which is why I'm surprised it doesn't work.
I'm trying to connect to the same PostgreSQL DB on Heroku that I use for the other Django app. Is that a problem? Do I need to reconfigure something here? Or do I ever need to run python manage.py migrate manually on Heroku? I think this should be taken care of by my Procfile.
Any ideas or tips?
I'm using Python 3.8 and Django 3.1.
The problem was really with trying to connect to the same PostgreSQL DB that I used for another Django App. I thought there would be just multiple tables in the same DB, but it doesn't work.
I created a new DB and configured the database URL accordingly and it worked.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have written a python script that will connect to the oracle database using cx_oracle and gets data and performs some action on it.
I want to expose this python script as a Restful API. In google, I read that using flask we can deploy a Python script as a Web service.
What I am not clear
The flask itself behaves like a server?
Can I deploy the python Webservice in the Web logic server?
I want to deploy this Webservice in production. How can I provide security to this?
In another site, I read using Connection, Swagger we can implement it.
I am actually written using flask, flask-jsonpify, flask-sqlalchemy, flask-restful.
Please suggest which packages i need to use to deploy it as WebService.
Let me know in case of any other details needed. Thanks in advance for your suggestions and guidance.
Vijay
The flask itself behaves like a server?
It can
Can I deploy the python Webservice in the Web logic server?
Not unless you are using Jython as WebLogic runs Java applications
I want to deploy this Webservice in production. How can I provide security to this?
See next point
In another site, I read using Connection, Swagger we can implement it.
See next point
I am actually written using flask, flask-jsonpify, flask-sqlalchemy, flask-restful.
Sounds like you've done some research into what packages you need. Maybe find more to get swagger and security figured out
Please suggest which packages i need to use to deploy it as WebService.
Refer point 1. flask is all you need to run the web server
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I developed a project on django, after that uploaded it on Github. I want to see this project any other computer, on django's development server but, when I downloaded the project and tried to run by python manage.py runserver command, localhost:8000 works but, I have TemplateDoesNotExist at/ errors. How can I fix this?
Make sure that you have all files and directory that have before in initial project root directory.
also check .gitignore file in the repository
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have developed a django app in django 1.7 version with python 2.7 and want to deploy it in python anywhere with free version, but python anywhere does not support it-
But it only supports django 1.3 with python 2.7. So what changes i have to make to run my code in it with django 1.3.
Else if anybody is having any other option for django(1.7) app deployment plz suggest me.
Also i have deployed my django app(1.7) with 3rd option selected(python 2.7, django 1.7) then the output is - link to my deployed app
PythonAnywhere dev here- you can actually install the version of Django that you want using a virtualenv!
The commands to run from bash are just
mkvirtualenv Django17
pip install django==1.7
And then making sure that you set your virtualenv path correctly in your webapps tab! (in this case your path would be /home/your-user-name/.virtualenvs/Django17/)
ie. You would have to set the virtualenv path as shown in the picture above
ps: on an unrelated issue to 1.7 vs 1.3, the reason that you are seeing the Django welcome page of the hello world/congrats on your first webapp variety is because that is the sample webapp that we have made for you.
You would need to correctly set up the paths to point to your source-code for your actual website to be displayed.
It is possible to install any version of Django in Pythonanywhere.
There is a link in Pythonanywhere wiki that provides detailed instructions to do it: Wiki
You can user Heroku, it works with that django you want or python or mostly anything you want, it has a free plan and you can make how many apps you want.
For your question ... to downgrade from django 1.7 to 1.3 ... there are too many thins to consider and we don't know what do you do on your project.
Or another option is Docker, i experimented with this.
You can even user Amazon , if you make an account you can get 12 months free trial, 750 hours / month for free with one machine.
The answer to your question is: You should follow the excellent release notes, but reverse them.
Each release note will tell you what’s new in each version, and will also describe any backwards-incompatible changes made in that version.
https://docs.djangoproject.com/en/1.7/releases/
But it is probably better find an alternative to pythonanywhere.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I need an idea how to implement following
1. Want to build python application which will update itself when the new patch is available
2. It will run the unit test to check if the patch deployed successfully
3. If there are any failure during installation it will rollback automatically
What I don't know
A. Not sure how to build a patch from the source code
B. Algorithm / standard process to check about the new updates are available
C. Auto deployment/Rollback process
Any suggestions/ links?
I implementeed a server that recognizes the changed source code and pulls the new code. It is hosted at pythonanywhere.com at this url and the code is on github. This answer bases on my experiences when implementing the update functionality.
When you version your code with git you usually
have a master or deploy branch that works
have a develop branch that is merged into the master-->deploy branch when all the tests run through.
This way you only need to know when the deploy branch changes in order to figure out when to restart. Tests should be run before in order to have no downtime. If you run the tests on the deploy system it may take them too much time or the invalid code destroys the system.
So the deploy branch works because it was tested before.
For automated testing you can use a continous integration server like travis that downloads the code and tests it. It can be asked about whether the test run of a specific commit.
When you host your code on github then you can specify a push http address. I used http://server/update Whenever the repository is changed github notifies your server then.
You can then update the source code by pulling it from git and if the deploy branch really changed then you can restart the application. I can not do this in the server ut maybe you can.
Scenario:
I push code to github
github sends a POST to http://server/update
#post('/update') # bottle code
def pull_own_source_code_and_restart():
with inDirectory(server_repository):
previous_commit = last_commit()
text = git.pull()
current_commit = last_commit()
if previous_commit != current_commit:
restart()
return "Git says: {}".format(text)
have a look at these two files:
command_line.py for the git commands
bottle_app.py for a derivating implementation if the server can not restart itself.
A version control system usually does the 'patching' for every version. I use git. If git is unknown to you now, learn it! Here is workshop material for Pythons Django and git: http://www.opentechschool.org/material.html
Let me now if this information is sufficient to implement such a functionality in Django. Please post your code here when you got it to work.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm in the early phases of designing and implementing a python web project that i want to be able to easily distribute.
Coming from a primary PHP and Perl world i know how i would do the project in those lanuages but I am trying to find the best method for python.
Not sure if it matters, but I'm thinking of using django as the web framework, but still exploring other frameworks.
What i'm looking for is best practices to be able to bundle my application and have users just install it using pip.
Would i be able to package the wen application like that even if it using django or is that not the way its normally done? Would they instead just download the code and set it up like it was any other tar ball of code?
I tried searching around for this but i find mostly information on people deploying there own projects.
Thanks
Dan
The answer depends of the size of your project.
If it's a plugin that could be integrated to any web site, so probally just an app in the project, it's quite easy check the page of the django's doc
If it's a full websitethen it's a little bit more complicated, since a django project depends on multiple settings that could differ from one system to an other I usually see the project being installed from a tar ball.
I've seen packages like django-admintools bundle multiple apps in one package, but the user still need to create a basic django project.
From what I know a full project cannot be install only by PIP.. the user always need to setup settings and the webserver (apache or nginx).
I hope this helped you.