Django put extra installed apps in a different settings file - django-settings

I'm trying to separate out my dev settings, and while there is a ton of info out there, I'm just going for the cs01's solution in this post here: Django: How to manage development and production settings?
So I was unable to create a settings folder and do it that way as it seems you have to then start rewriting the manage.py file which I don't want to do right now, I'm not that skilled. So the above post has a nice simple solution for what is an internal work only site. However while I am able to set:
DEBUG = False
in the main settings and set it to True in my local, that works well, I am unable to add installed apps, I have tried this in my settings_dev.py
DEBUG = True
INSTALLED_APPS += [
'django_extensions',
]
So I get INSTALLED_APPS is not defined. how can this be worked around? currently the extra installed apps are sitting at the end of the settings.py file like this:
if os.environ.get('DJANGO_DEVELOPMENT'):
from .settings_dev import *
INSTALLED_APPS += [
'django_extensions',
]
Is there an easy way to shift the extra INSTALLED_APPS into my dev settings? I have other extensions I want to add like the debug-toolbar, but that includes extra middleware, so I'm expecting the same situation there also.

Not a complete answer to your question, but answers it for people using dynaconf together with django.
Dynaconf allows you to "merge" lists and dictionaries instead of overriding them (https://www.dynaconf.com/merging/), so that in the config file you can use dynaconf_merge_unique and have something like this:
local: &LOCAL
<<: *DEVELOPMENT
INSTALLED_APPS:
- dynaconf_merge_unique
- sslserver
- django_extensions
This causes sslserver and django_extensions to only be installed in the local environments.
Again, sorry that this is specifically a dynaconf answer, but perhaps will be useful to someone reading this question.

Related

How to use local environment variables that don't belong to a library?

I have some variables that depend on the environment. They don't belong to a deps library but the only way I know is to import them like if they were.
I import them them in config.exs like this:
config :martin,
url: "http://localhost:4001"
I then define the different urls for production and staging in staging.exs and prod.exs and it is working fine.
But I get this warning for each of the variables I import this way
You have configured application :martin in your configuration
file, but the application is not available.
This usually means one of:
1. You have not added the application as a dependency in a mix.exs file.
2. You are configuring an application that does not really exist.
Please ensure :martin exists or remove the configuration.
Is there a way to do it in a more correct way that won't trigger a warning?
You can use the name of your app instead...
config :my_app,
martin_url: "http://localhost:4001"

typo3 website move to other domain - need help step by step

I just got a typo3 website and need to transfer to an other domain.
Is it enough to copy all the folders (except typo3temp?) to the new place?
First I just changed baseurl in ts but it didn't do anything..
Should I do anything with the database when it still on the same server?
In case your question is about "cloning" a complete TYPO3-system an rsync/copy of the whole folder (yes including typo3temp) is the best idea, as this works on all versions, everything else (like excluding typo3temp) depends a whole lot on your TYPO3 expertise to resolve. The database needs to be copied as well. If you need to change db-name or db-credentials on the new system you need to change them in
typo3conf/LocalConfiguration.php
As soon as you have done this Install Tool and Backend should work: At first try the Install Tool:
https://my.new.domain/typo3/install/
If that doesn't work your problem is with the webserver configuration or dns.
If that works (and the reports there show no errors), try the Backend:
https://my.new.domain/typo3/
In case your question is about which changes are necessary to your TYPO3-installation if domain changes and the web server itself is configured correctly, then there are probably two things you need to change, in order to make the frontend work (although both cases might be omitted, depending on your configuration):
sys_template record, if any of those use absRefPrefix or baseurl. If you have access to the MySQL-Database a
SELECT pid FROM sys_template WHERE config LIKE "%baseurl%" OR "%absRefPrefix";
might help finding the template, however these template configuration might also be stored in files (typically in fileadmin/templates/**)
sys_domain records, a MySQL
SELECT pid FROM sys_domain;
might uncover where those are stored
However these changes are only necessary to enable the frontend to work.
Add a domain record in the backend. And while you don't need the content of the typo3temp folder, make sure the folder actually exists.
When you go to the new domain name in your browser, what happens?
Do you get redirected to the old domain? If so, maybe there is an .htaccess redirect happening.
Do you get to the new domain, but if you click on a link end up on the old one?
Do you get an error? If so, what is the error?
Does something else happen?

Read config settings from PhoneGap app

Apparently I'm terrible at Googling. All I want to do is have the ability to read my web service URL from a config file in my PhoneGap app. Also, be able to modify that value during the build process. Is this named alot different in Xcode? I think I need to save this value in the plist file. If that's the case, then I can just set a user-setting in my build configuration stuff to have it change depending on which build type, Dev/Release.
If that's true, how do I access this from PhoneGap?
I'm guessing this question will get closed, but where else do I go for help...
plist file for cordova project already depreciate since v2.2. Cordova v2.3 start using config.xml.
Target > Edit Scheme
You could probably use hooks to accomplish everything that you are trying to do without changing around the config.xml file, but I'm not entirely sure this is supported with Phonegap (it is with Cordova.)
Check out the official help page to use the /hooks/ folder to modify anything during the build process: https://github.com/apache/cordova-cli/blob/master/templates/hooks-README.md
This blog post also seems pretty useful: http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/ it talks about changing things based on the environment and I'm sure it'd be easy to extend that to changing based on dev/release.
You could store the link to your web service probably as a config variable. I'm trying to figure out how you can add a config variable and will report back if I get it. In the mean time you could probably just have something like a server.txt file that you change with hooks.

Issue with startitem in Sitecore

We have four different environments - dev VMs, dev, QA and prod. All environments have the following setting for the "website" site:
<site name="website" virtualFolder="/" physicalFolder="/"
rootPath="/sitecore/content" startItem="/home" database="master"
domain="extranet" allowDebug="true" cacheHtml="false"
htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0"
xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true"
enableWebEdit="true" enableDebugger="true"
disableClientData="false" loginPage="/" hostName="www.site.com"
enableFallback="true" enforceVersionPresence="true"/>.
So on VM and prod, www.site.com/en/home/press and www.site.com/en/press work.
But on dev and QA, www.site.com/en/home/press works but www.site.com/en/press doesn't work. (Works with startItem but gets a 404 without it).
This is happening with ISAPI enabled and disabled both (no exceptions).
I am not sure what is going on here or where else to look except to make sure that my start item is in good shape which it seems to be.
What can I do to resolve this? If you need more information please let me know.
Thanks
Try looking at the:
"linkManager" tag in the web.config, there is a property called:
languageEmbedding: asNeeded | always | never
which could be set differently on those solutiuons.
If you have Multi-Language website it is recommended to go with
languageEmbedding: always
Advantages :
Some time in IE8 the Language cookie is destroyed, because of that
the language displayed is change randomly.(We have faced this issue
in our environment) LanguageEmbadding : Always will keep the Information and will work without any Issue.
If you have set asNeeded then First time the Language will be displayed and next time onward it will be hidden. But this will create issue with Google Analytics. In GA you will have 2 diff URL with same page content so your analysis will be unnecessarily divided in to 2 pages.
And Yes you can check if there is any difference is Config files. As Mentioned by Martijn you can use the www.site.com/sitecore/admin/showconfig.aspx Copy the Config, compare it using any file compare tool like WinMerge etc.
What is the Hierarchy in your project?
Sitecore-Content-home-Press or
Sitecore-Content-home-Home-Press?
In my project the setting you have mentioned has database = web.
I can't add a comment, but as Martijn says you need to compare the configs. Now this should be very easy since you should be using config include files and so the changes between the environments should be very minimal. If you are not using them then you should start using them, it makes life much easier to figure out the differences from default Sitecore installation and will also make your upgrades much easier in the future. Or maybe you are using them for the other environments and that is what is causing the issue?
All About web.config Include Files with the Sitecore ASP.NET CMS
As for comparing the configs, use a file comparison tool like WinMerge as already metioned, that should weed out the differences much more easily.
Also, as Maulik says, default config has: database="web" content="master"
This seems like config differences. Compare the live configs by using www.site.com/sitecore/admin/showconfig.aspx. This way you can see the actual config which also includes all your /app_config/include/ files

Symfony 1.4 Backend app for admin fail on Prod environment

I have a perfectly working admin backend on my dev environment but it fails miserably on the prod environment. Specifically a bunch of problems arise :
It is unable to read the symfony/web/sf/ directory hence not loading the required images though it states that a project has been successfully created. This however is not the case with the frontend leading me to believe that the problem is more sinister than what meets the eye.
Though it loads the admin pages, the css is not loaded, even though admin.css is present in the web/css directory.
I did an inspect element and the problem seems to be this, instead of routing to
/web/css or /sfDoctrinePlugin or /web/js
it prefixes the name of the app [controlcenter in my case] to everything, essentially rendering the HTML as:
href = "/controlcenter/web/css" or href = "/controlcenter/js" or href = "/controlcenter/js" . And this does not happen at all on my dev environment and things render the way they do.
Fixits anyone?
This was completely ridiculous of me to post this. I was simply trying to go to controlcenter/module which basically translates to backend/module for most people.
The index file in this case is controlcenter.php, and upon accessing that, I get the website to render the way it ought to. Sorry for the confusion people. Hopefully someone drops in by and sees the answer for themselves.
I should set up defaults in my routing.yml so that it automatically redirects without me having to type controlcenter.php
Thanks

Resources