I am working within the File Manager of Hostgator and have already set up a Django project which displays "It worked! Congratulations on your first Django-powered page." Following this, I ftp'ed my local Django project (which works fine on the local server) into File Manager and stored it into a temp folder, copying over the changes to the urls.py, views.py, and settings.py files of the new Django project along the settings path.
However, nothing appears to be changing on the website - it's still on the "Congratulations" page. I've tried moving various templates into different places to see if it responds, but that doesn't appear to be doing the trick. Thoughts?
You need to read documentation about how to manage your project on the hostgator servers
Related
I have a self-hosted (raspberry pi) website running on Django - one project with several apps all serving on one domain name. I'm more of a programmer than a server admin, but it works! Now, I'd like to break one of those apps out onto a second domain name, but still hosting from my pi.
--I've looked into a lot of tutorials on how to do this as well as checked out answers like this one but the server-related instructions on everything I've found so far all go a bit over my head or don't seem to match up with my setup.
--I've tried the Django Sites framework and I've also followed this tutorial. While I was able to get my site objects in the db, all requests seem just to go to SITE_ID=1, regardless of domain name. I've seen conflicting information here about whether or not SITE_ID should be present in settings.py, but whenever I remove it, I just get errors about it (even though I do have the CurrentSiteMiddleware installed as well as a custom middleware like indicated in that tutorial).
Here's what I've got for Django (3.2.14, and py3.7.3), essentially:
DjangoApps
-mysite
--settings.py (allowed_hosts includes mydomain)
--urls.py (imports from app urls files)
--(etc)
-app1
--urls.py
--(etc)
-app2
--urls.py
--(etc)
-app3
--urls.py
--(etc)
and then the server confs:
/etc/apache2/sites-available/
-000-default.conf
-default-ssl.conf
-mydomain.com.conf [which points to the DjangoApps directory]
-mydomain.com-le-ssl.conf
I do not have an http.conf as mentioned in many of the tutorials/answers I've read through. I've seen some notes about using virtualenv and/or wsgi but I don't understand them, and I am requesting a more handholding step-by-step explanation of what to do here.
I assume this isn't the most optimal/modern way of doing this, but the key point here is that this main site is already live and working as-is so I'm really not looking to redo the whole thing. All I want to do is make it so that myseconddomain.com serves app3 only, and mydomain.com keeps serving everything (or, everything but app3, if that's easier).
Please help! And please let me know what other info is required.
I recently made some changes to my django site, one big one being upgrading from Django 2.2 to 3.1. Now my admin site styling is all messed up. I can't figure out what went wrong or how to fix. Any pointers would be appreciated!
See image of what it looks like after update....
The main home page for admin looks fine, but when I click on one of the models to view, the formatted is definitely not correct.
Also, some not all, of my images on the site are saying 404 not found...
It looks like your browser is caching the CSS / JS from the old version, you can clear your cache and reload. In chrome use ctrl + shift + r to reload.
I was facing the same problem, First I thought it was a Cache issue but it wasn't.
I checked the page source and found a css file being applied to the page which wasn't even present on my drive.
In my case the file was:
static/admin/css/nav_sidebar.css
So I created new file in static/admin/css named nav_sidebar.css,
then copy pasted the code which I got from page source and
added "display:none;" in the #nav-sidebar section(line:34) and [dir="rtl"] #nav-sidebar section(line:45 in my case).
You can find the Original code here by using Google Chrome's inspect tool.
Where to find the code
I had the same issue after bumping django from v3.0 to v3.1. I run python manage.py collectstatic to update css which solved my issue
I was experiencing the same styling as the OP's screenshots.
I had upgraded incrementally from 2.2 -> 3.0 -> 3.1 -> 3.2. I only experienced the styling issues in 3.2
The issue was that there were legacy admin styles committed to the repo in the static folder. To resolve, all I did was delete the committed admin styles, and Django then appeared to use its own styling
I was upgrading from 3.0 to 3.2 and I tried a couple of the answers here without luck. At the end, the following procedure solved it for me:
manually delete the content of the directory STATIC_ROOT (see in settings.py what you named the folder)
run the command python manage.py collectstatic This will repopulate the directory with the newst files
hard refresh your page (ctrl + F5)
I think the other answers here are necessary, but I'll add one more: You might have to bust caches in your server itself. In our example, nginx was configured to provide really long caches to our static files, so we just had to reset it to make changes come through.
Ok maybe I am late to the party but it may help others,
What works for me is:
Set STATIC_ROOT in settings.py (I guess it should be already there as project is old one)
Comment STATIC_DIR in STATICFILES_DIRS list (otherwise it will give error) and run python manage.py collectstatic
Clear browser cache.
Good morning. I have a dedicated ubuntu server behind my company's firewall. It is using Django, Gunicorn, and Nginx to serve an Intranet application to employees. The original app responds to the URL [server_name]/[original_application_name]. I want to serve additional apps from this server. I have followed this tutorial as I did when setting up the original app.
I can run Gunicorn and serve the app, I have created a second systemd service file that appears steady (copied from the original app with paths changed - service runs), same for a new 'sites-available' file in Nginx (copied from original and modified), new .sock file exists, binding appears successful. However, I have yet to hit on the right configuration combination between settings.py [allowed_hosts], [new_app].service, and nginx etc.
The original app is running and when I try a URL related to the new app it gives an error saying it cannot find the request in the url.py of the original app. The new app would be used by the IT dept. Ideally, the new URL would be something like: it.[server_name]/[new_application_name].
I have looked through other cases with this problem but most use Apache or are on a public hosting site. I have seen this but it requires a "socket file". My original app is not using a socket file. I was hoping to do this without interfering with the original app. Is a "socket file" required? How can I configure this to serve both apps? Never having done this, what will the new URL be? The URL for the admin site in both apps is 'admin/', how can I accommodate this? Thanks!
I combined into one file as you suggested and I am almost there! I have original site responding at [server_name]/inventory and new site responding at [server_name]/assets. Great! My only problem is the admin page. In both apps the admin site is called admin! So, [server_name]/admin brings up the original site. How can I get to the new admin page?
Django version 1.4, using Supervisor, NGINX, gunicorn, and postgresql 8.4. The project where an app was located has been moved to a different server which also has the domain now. I had another project hosted on this same server, and I want to move my app over to that project with all database data intact.
I moved the app files (models.py, views.py, etc.) to a folder in the destination project, moved the templates to corresponding folders, added the app to the destination project's settings.py, and ran manage.py syncdb. Using PGAdmin's backup and restore I moved all of the data over. After updating some relative references in the python files I was able to access all of the database data (which seems entirely intact) in the Django admin site.
Now the problem: the new urls seem to work fine, but it is using the old project's .py files and all templates. I even commented out the app in the settings files of both new and old projects and all it did was hide the admin site from me.
To identify the problem I inserted a typo into the old project views.py, and got it to throw a traceback, which let me see that it was using the old project's settings.py instead of the new one. How do I make the app switch to the new project settings.py? How is it even finding the old one?
I realize after the fact that this question probably belongs on Server Fault instead of Stackoverflow. I did figure this out, though, and posted the answer on SF:
https://serverfault.com/a/722742/311615
I'm running a Django app for my root public_html folder, and it's working fine. But there's a problem with one of my other apps. The problematic app is accessed through a redirect to a subdirectory (e.g. http://workingsite.com redirects to public_html, http://brokensite.com redirects to public_html/foo)
The problem is that the session expires whenever anything needs to be saved in the Django admin (either added or changed). If you try again, sometimes it works. This does not happen on my own machine when I run the Django dev server.
The timezone in both of the app settings.py files is the same, which is the same as the timezone in both of the .htaccess files.
The apps are almost identical, except the working app uses WYMEditor and the broken one uses TinyMCE as its text editor. Don't know why that would do anything to cause the problem, but I included it just in case. Also, I've made a custom CSS file for the admin backend in the broken app (again, shouldn't cause a problem).
Seems to have been a configuration issue with the company I was hosting with - it's not happening anymore.