Default template is broken on new Mezzanine install. - python

I had a little trouble even getting Mezzanine to install and now that I have the css seems broken. I have looked all over the web and can't seem to find out where my mistake is. The instructions I followed are here:
https://www.a2hosting.com/kb/developer-corner/python/installing-and-configuring-mezzanine-on-shared-hosting
My site is as at the following link:
http://wakeofthetranscendent.a2hosted.com/
I really am not even sure of what code to post because I have no idea where the problem is. I was able to get it running using runserver on my laptop but as my a2 account is shared I don't have that option.

Related

How do I stop all of my projects redirecting to a specific URL?

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.

Upgrade Django from 1.6.2 to latest version (~1.8)

So I've been tasked with upgrading a Django server from 1.6.2 to the latest (~1.8), along with upgrading Python from 2.7.3 to 3.3. I suspect this is going to break quite a bit of code. (I even need to upgrade the Ubuntu installation from 12.04 to 14.04)
I would like to migrate my Django app from the server it's currently running on (Ubuntu 12.04) to a virtual machine, and use that environment as a sandbox to make changes.
Would anyone be so kind to provide guidance on django app migration? Please let me know if you'd like me to provide any specific details.
Thank you.
Edit: If anyone would like to vote down this question because they believe I haven't done enough research, I'm very happy to add missing information, if I know what you're looking for.
Django versions from 1.5 onwards has been designed so that the same code will work on both versions of Python as in the documentation thanks to them following the six compatibility layer.
You might face some issues with code that isn't strictly related to Django components like print statements and other such parts that might have been coded in. The official Python Porting Guide should held you with that.
Django 1.8 is a LTS (Long Term Release) so it's a good idea to upgrade to it. Migrating the database might be a bit of an issue considering it's from 2.7 to 3.4 but that's in all likelihood the place you'll find most issue with. The How to Migrate is a great resource.
If I recall correctly the directory structure is a bit different in 1.6 so you'll have to move some code and files manually. I suggest having the tutorial pages for both versions 1.6 and 1.8 open and comparing the directory structure.
Going through the first 2 pages of the tutorial should give you enough of an overview to migrate the database and the settings file. This should also help with migrations.
The 3rd and 4th pages should get you through migrating the views and urls files.
The only thing I'm not familiar with is the migration of the wsgi file which has configuration information, you should be able to find some basic information about that here.
Updating your Ubuntu however won't change or affect anything at all.
Also as has been said in the comments by jape and joel, it's a good idea to use virtualenv and git.
I would like to add another suggestion based on my own experience with pushing code to a Django server :
Download the code base to your local machine and work there and once you're done and the server is working well on your machine push it all to the server at once. That way you can isolate server machine specific issues from coding issues.

django stripe set up installation error

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

How to deploy codenode

Aloha everyone,
So I was hoping to deploy codenode 'http://codenode.org/', on my website nested within a page. For the life of me I just can't follow the documentation and figure out what I'm supposed to do.
It only ever seems to talk about running things locally from the terminal, how are you supposed to set it up with regards to views, models and templates?
Thanks in advance.
They're simply telling you to install it via pip and virtualenv. This isn't terribly difficult to do on a host that is very Django and Python friendly, such as WebFaction. You can always put the necessary files where they need to go so that they will be added to your Python path via FTP, etc.

What do I need to successfully run a website in my browser that executes Python scripts?

I currently simply have a local website on my Mac. I can view the webpage's HTMl and CSS and run the javascript functions in browser on my computer, but the next step I want to take is incorporating python scripts for accessing a MySQL database and returning results.
I am clearly new to this, and would love some guidance. Right now, on my computer, I have MySQL installed and I can run it in the terminal just fine. What else do I need as far as database and server equipment – if anything – to get some dynamic website running locally? My current, albeit incredibly limited, understanding is that I have a MySQL database stored on my machine that can be accessed through a Python script – also on my machine – and a link to this script in the HTML file. Is this even right, or do you recommend certain tutorials to fill in the gaps or teach me from the ground up?
I am sorry I am asking a lot; the few tutorials I have found have seemed to cover what I am hoping to do. Many thanks in advance.
Here you go. https://docs.djangoproject.com/en/1.4/intro/install/
Just follow the installation guide, and you'll be up and running in no time.
If you have MySQL installed on your machine along with Python, get a version of MySQLDb library for Python and have fun with it. Moreover, you can do almost any data operation with these combinations. If you want your website to go live (and do not wish to go through web frameworks) just look for a hosting plan that gives you a Python installed server access.

Categories