My problem is down to my lack of experience with django (and coding) and stripe.
I am trying to test a very basic stripe payment on a test form on my local development server, but I am getting an error message when I try to start my local development server.
Here is a a screen grab of the issue:
Can somone give me an idea of what I have done wrong and how I even start to go about solving the issue? I am using djstripe which I have pip installed.
I have searched my templates and gone over my code and SO and Google, but I am still stumped. I have djstripe installed in my INSTALLED_APPS.
Is there a tutorial of how to read and interpret the errors in the above screen grab, or does the understanding mainly come from experience?
You need to define STRIPE_PUBLIC_KEY (and STRIPE_SECRET_KEY I believe) in your settings.py. You can get this key from stripe if you have an account.
If you follow the instructions you will see this. https://github.com/pydanny/dj-stripe
A google search for "reading python stack trace" gives us this:
https://www.odoo.com/forum/help-1/question/how-to-read-and-understand-errors-from-tracebacks-9704
Related
I have been trying to learn Django to build a personal website where I can host some machine learning stuff I've made for others to use. In the process, I found this tutorial by Mozilla. I think what created the issue was the part saying RedirectView.as_view(url='catalog/', permanent=True). I was trying to make a simple function grapher for my site, so I used 'grapher/' instead of 'catalog/'. Now, that worked for what I was trying to do. Then I created a new django project to try some things from a different tutorial, and now when I try to run "py manage.py runserver" and go to http://localhost:8000, I still get redirected to http://localhost:8000/grapher/. This happens in all of my django projects, new and old.
Now, the really mysterious part to me was that when I tried deleting those projects AND the virtual environments I was using, then making a new virtual environment and project, I still get redirected http://localhost:8000/grapher/. I have also tried adding "path('', RedirectView.as_view(url='', permanent=True))," to my project.urls.py file which did not work. If there are some commands I can run to give more information, I would love to. I just don't know what other detail I can post since I deleted the projects. I just want to know how to change this redirecting behavior, and a bonus would be understanding better how the issue arose.
If RedirectView.as_view() isn't the issue, previously I had been working with static files changing STATIC_ROOT, STATICFILES_DIRS, and using collectstaticfiles.
Answer per Willem Van Onsem: permanent=True causes the browser to cache the redirect. Clearing the cache fixes it.
I make this topic as we have a problem uploading a python archive in Azure. We did a modular code with python, which is a text generator. The code is working on python environment, besides we wanted to upload it to the cloud. When we tried it, we used the App service of Microsoft azure, we didn’t have any trouble while we were doing the process this way. Nevertheless, at the end, the program gave us a json, when we tried to put that URL into the navigator… There’s were the problem is, the generated Jason doesn’t connect with the navigator. We don’t have any clue of what’s happening, because the console doesn´t give any warning or error.
If any of you knows or have a tip for us to solve this problem, I would appreciate it,
Thanks for your attention and have a nice day.
Welcome to Stack Overflow! From what I understand, I suppose you should be going with Azure Automation Runbooks instead of Azure App Service, if you intend to execute or automate a task-like job. You can also test your runbook and implement error handling streams to ensure it works as expected. Please refer to this example for a detailed walkthrough.
Please elaborate your requirement if this is not what you were looking for, and we can explore other alternatives.
I have been working on a localhost copy of my Django website for a little while now, but finally decided it was time to upload it to PythonAnywhere. The site works perfectly on my localhost, but I am getting strange errors when I do the initial migrations for the new site. For example, I get this:
mysql.connector.errors.DatabaseError: 1264: Out of range value for
column 'applied' at row 1
'applied' is not a field in my model, so this error has to be generated by Django making tables for its own use. I have just checked in the MySQL manager for my localhost and the field 'applied' appears to be from the table django_migrations.
Why is Django mishandling setting up tables for its own use? I have dropped and remade the database a number of times, but the errors persist. If anyone has any idea what would cause this I would appreciate your advice very much.
My website front end is still showing the Hello World page and the Admin link comes up with a page does not exist error. At this stage I am going to assume this is related to the database errors.
EDIT: Additional information about why I cannot access the front-end of the site:
It turns out when I am importing a pre-built site into PythonAnywhere, I have to edit my wsgi.py file to point to the application. The trouble now is that I don't know exactly what to put there. When I follow the standard instructions in the PythonAnywhere help files nothing seems to change. There website is also seems to be very short on detailed error messages to help sort it out. Is there perhaps a way to turn off their standard hello world placeholder pages and see server error messages instead?
As it says in my comment above, it turns out that the problem with the database resulted from running an upgrade of Django from 1.8 to 1.9. I had forgotten about this. After rolling my website back to Django 1.8, the database migrations ran correctly.
The reason why I could not access the website turned out to be because I had to edit the wsgi.py file, but I was editing the wrong version. The nginx localhost web server I was using keeps it in the different folder location than PythonAnyhwere's implementation. I uploaded the file from my localhost copy and edited it according to the instructions on PythonAnywhere's help system without realizing it was not being read by PythonAnywhere's server. What I really needed to do was edit the correct file by accessing it through the web tab on their control panel. Once I edited this file, the website front end began to work as expected.
This issue occurred for me as well on version 1.10 with a brand new project. I found that if you use the recommended driver and the connector in the documentation, the migration works without issues.
If you don't feel like reading the docs, in breif:
Install MySQLdb for python 2.7 or mysqlclient for python 3.3+
Modify your settings.py file. In the DATABASES dictionary set:
'ENGINE': 'django.db.backends.mysql',
I've been successfully able to run syncdb's on my django project for the past weeks, but something must have happened and I'm not sure what.
I always get this error:
No module named google.appengine.ext.django.backends.rdbms.base
I'm not sure why it's just kind of started. Shortly after getting this error, I tried updating my project on app engine and was prompted to download a new app engine launcher SDK, which I have done, but this error still exists. Not sure if maybe something is wrong with my PYTHONPATH?
From your description, this sounds like it could possibly be an issue, not intended behaviour. It sounds crazy, but perhaps something changed with the default Django installation. I suggest you attach a basic reproducing app to a new issue thread in the Public Issue Tracker
You may need to authorize your IP address. If that doesn't work, try using the standard MySQL driver instead of the Google App Engine one as described in our docs.
I had a Django project that uses python 3.2+. Having been through a couple Azure classes I wanted to deploy my Django application through Windows Azure. I got the web site synced through my Git Repository, and following the advice of the MSDN forums, added the python 33 runtime in a folder called /PythonCore/ and added WSCGI.py to the scripts folder within there.
My website can''t find the CGI interface and likewise is failing to process HTTP requests. I know something must be wrong in my configuration, but I havn't a clue as to what. I was wondering if anyone might know what my error is.
WEBSITE_NODE_DEFAULT_VERSION 0.10.5
DJANGO_SETTINGS_MODULE DjangoApplication.settings
PYTHONPATH D:\home\site\wwwroot\DjangoApplication;
WSGI_HANDLER django.core.handlers.wsgi.WSGIHandler
Handler Mappings
* D:\home\site\wwwroot\PythonCore\python.exe D:\home\site\wwwroot\PythonCore\scripts\wfastcgi.py
Please let me know if any additional information is needed or you have an idea what I can try.
Azure Web Sites w Django currently requires Python version 2.7. Please see this:
http://www.windowsazure.com/en-us/develop/python/tutorials/web-app-with-django-and-mysql/
and
http://pytools.codeplex.com/wikipage?title=Django%20Web%20Site/Cloud%20Service%20Tutorial
Corresponding video walk thru:
http://www.youtube.com/watch?v=S7A7VNnsA_8
Python 3.x will be supported soon (hopefully fall 2013).